feat: cron ISO at + delete-after-run

This commit is contained in:
Peter Steinberger
2026-01-13 04:55:39 +00:00
parent 8f105288d2
commit 75a7855223
17 changed files with 221 additions and 17 deletions

View File

@@ -75,4 +75,40 @@ describe("normalizeCronJobCreate", () => {
const payload = normalized.payload as Record<string, unknown>;
expect(payload.provider).toBe("telegram");
});
it("coerces ISO schedule.at to atMs (UTC)", () => {
const normalized = normalizeCronJobCreate({
name: "iso at",
enabled: true,
schedule: { at: "2026-01-12T18:00:00" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
payload: {
kind: "systemEvent",
text: "hi",
},
}) as unknown as Record<string, unknown>;
const schedule = normalized.schedule as Record<string, unknown>;
expect(schedule.kind).toBe("at");
expect(schedule.atMs).toBe(Date.parse("2026-01-12T18:00:00Z"));
});
it("coerces ISO schedule.atMs string to atMs (UTC)", () => {
const normalized = normalizeCronJobCreate({
name: "iso atMs",
enabled: true,
schedule: { kind: "at", atMs: "2026-01-12T18:00:00" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
payload: {
kind: "systemEvent",
text: "hi",
},
}) as unknown as Record<string, unknown>;
const schedule = normalized.schedule as Record<string, unknown>;
expect(schedule.kind).toBe("at");
expect(schedule.atMs).toBe(Date.parse("2026-01-12T18:00:00Z"));
});
});