test(cron): relax event assertions for context keys

This commit is contained in:
Peter Steinberger
2026-02-15 03:53:49 +00:00
parent f1a76e1a36
commit 9db2ebed00
6 changed files with 52 additions and 27 deletions

View File

@@ -110,9 +110,10 @@ describe("#16156: cron.list() must not silently advance past-due recurring jobs"
const updated = jobs.find((j) => j.id === job.id);
// Job must have actually executed.
expect(enqueueSystemEvent).toHaveBeenCalledWith("cron-tick", {
agentId: undefined,
});
expect(enqueueSystemEvent).toHaveBeenCalledWith(
"cron-tick",
expect.objectContaining({ agentId: undefined }),
);
expect(updated?.state.lastStatus).toBe("ok");
// nextRunAtMs must advance to a future minute boundary after execution.
expect(updated?.state.nextRunAtMs).toBeGreaterThan(firstDueAt);
@@ -164,9 +165,10 @@ describe("#16156: cron.list() must not silently advance past-due recurring jobs"
const jobs = await cron.list({ includeDisabled: true });
const updated = jobs.find((j) => j.id === job.id);
expect(enqueueSystemEvent).toHaveBeenCalledWith("tick-5", {
agentId: undefined,
});
expect(enqueueSystemEvent).toHaveBeenCalledWith(
"tick-5",
expect.objectContaining({ agentId: undefined }),
);
expect(updated?.state.lastStatus).toBe("ok");
cron.stop();