refactor(cron): reuse cron job builder in issue-13992 tests

This commit is contained in:
Peter Steinberger 2026-03-07 17:09:18 +00:00
parent d918fe3ecf
commit 41e0c35b61
1 changed files with 4 additions and 18 deletions

View File

@ -46,21 +46,14 @@ describe("issue #13992 regression - cron jobs skip execution", () => {
const now = Date.now();
const pastDue = now - 60_000;
const job: CronJob = {
id: "test-job",
name: "test job",
enabled: true,
schedule: { kind: "cron", expr: "0 8 * * *", tz: "UTC" },
payload: { kind: "systemEvent", text: "test" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
const job = createCronSystemEventJob(now, {
createdAtMs: now - 3600_000,
updatedAtMs: now - 3600_000,
state: {
nextRunAtMs: pastDue,
lastRunAtMs: pastDue + 1000,
},
};
});
const state = createMockCronStateForJobs({ jobs: [job], nowMs: now });
recomputeNextRunsForMaintenance(state, { recomputeExpired: true });
@ -73,21 +66,14 @@ describe("issue #13992 regression - cron jobs skip execution", () => {
const now = Date.now();
const pastDue = now - 60_000;
const job: CronJob = {
id: "test-job",
name: "test job",
enabled: true,
schedule: { kind: "cron", expr: "0 8 * * *", tz: "UTC" },
payload: { kind: "systemEvent", text: "test" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
const job = createCronSystemEventJob(now, {
createdAtMs: now - 3600_000,
updatedAtMs: now - 3600_000,
state: {
nextRunAtMs: pastDue,
runningAtMs: now - 500,
},
};
});
const state = createMockCronStateForJobs({ jobs: [job], nowMs: now });
recomputeNextRunsForMaintenance(state, { recomputeExpired: true });