Skip to content

Commit 8562aa8

Browse files
committed
test: tighten cron task cleanup assertion
1 parent 83c238d commit 8562aa8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/cron/service/timer.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ describe("cron service timer seam coverage", () => {
7979
expect(job.state.lastStatus).toBe("ok");
8080
expect(job.state.runningAtMs).toBeUndefined();
8181
expect(job.state.nextRunAtMs).toBe(now + 60_000);
82-
expect(findTaskByRunId(`cron:main-heartbeat-job:${now}`)).toMatchObject({
82+
const task = findTaskByRunId(`cron:main-heartbeat-job:${now}`);
83+
expect(task).toMatchObject({
8384
runtime: "cron",
8485
status: "succeeded",
8586
endedAt: now,
86-
cleanupAfter: expect.any(Number),
8787
});
88+
expect(task?.cleanupAfter).toBe(now + 7 * 24 * 60 * 60_000);
8889

8990
const delays = timeoutSpy.mock.calls
9091
.map(([, delay]) => delay)

0 commit comments

Comments
 (0)