mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 15:30:35 +00:00
perf(test): speed up suites and reduce fs churn
This commit is contained in:
@@ -24,9 +24,6 @@ async function makeStorePath() {
|
||||
const storePath = path.join(dir, "jobs.json");
|
||||
return {
|
||||
storePath,
|
||||
cleanup: async () => {
|
||||
await fs.rm(dir, { recursive: true, force: true });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -152,7 +149,6 @@ describe("Cron issue regressions", () => {
|
||||
}
|
||||
|
||||
cron.stop();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("repairs missing nextRunAtMs on non-schedule updates without touching other jobs", async () => {
|
||||
@@ -183,7 +179,6 @@ describe("Cron issue regressions", () => {
|
||||
expect(updated.state.nextRunAtMs).toBe(created.state.nextRunAtMs);
|
||||
|
||||
cron.stop();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("does not advance unrelated due jobs when updating another job", async () => {
|
||||
@@ -230,7 +225,6 @@ describe("Cron issue regressions", () => {
|
||||
expect(persistedDueJob?.state?.nextRunAtMs).toBe(originalDueNextRunAtMs);
|
||||
|
||||
cron.stop();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("treats persisted jobs with missing enabled as enabled during update()", async () => {
|
||||
@@ -366,7 +360,6 @@ describe("Cron issue regressions", () => {
|
||||
|
||||
cron.stop();
|
||||
timeoutSpy.mockRestore();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("re-arms timer without hot-looping when a run is already in progress", async () => {
|
||||
@@ -400,7 +393,6 @@ describe("Cron issue regressions", () => {
|
||||
.filter((d): d is number => typeof d === "number");
|
||||
expect(delays).toContain(60_000);
|
||||
timeoutSpy.mockRestore();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("skips forced manual runs while a timer-triggered run is in progress", async () => {
|
||||
@@ -467,7 +459,6 @@ describe("Cron issue regressions", () => {
|
||||
await cron.list({ includeDisabled: true });
|
||||
|
||||
cron.stop();
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("#13845: one-shot jobs with terminal statuses do not re-fire on restart", async () => {
|
||||
@@ -523,7 +514,6 @@ describe("Cron issue regressions", () => {
|
||||
expect(enqueueSystemEvent).not.toHaveBeenCalled();
|
||||
cron.stop();
|
||||
}
|
||||
await store.cleanup();
|
||||
});
|
||||
|
||||
it("records per-job start time and duration for batched due jobs", async () => {
|
||||
@@ -569,7 +559,5 @@ describe("Cron issue regressions", () => {
|
||||
expect(secondDone?.state.lastRunAtMs).toBe(dueAt + 50);
|
||||
expect(secondDone?.state.lastDurationMs).toBe(20);
|
||||
expect(startedAtEvents).toEqual([dueAt, dueAt + 50]);
|
||||
|
||||
await store.cleanup();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user