Cron: guard missing expr in schedule parsing

This commit is contained in:
Vignesh Natarajan
2026-02-21 20:18:11 -08:00
parent eea0a68199
commit 961bde27fe
6 changed files with 45 additions and 2 deletions

View File

@@ -33,4 +33,13 @@ describe("cron stagger helpers", () => {
expect(resolveCronStaggerMs({ kind: "cron", expr: "0 * * * *", staggerMs: 0 })).toBe(0);
expect(resolveCronStaggerMs({ kind: "cron", expr: "15 * * * *" })).toBe(0);
});
it("handles missing runtime expr values without throwing", () => {
expect(() =>
resolveCronStaggerMs({ kind: "cron" } as unknown as { kind: "cron"; expr: string }),
).not.toThrow();
expect(
resolveCronStaggerMs({ kind: "cron" } as unknown as { kind: "cron"; expr: string }),
).toBe(0);
});
});