feat: cron ISO at + delete-after-run
This commit is contained in:
@@ -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"));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user