mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 02:03:43 +00:00
Cron: guard missing expr in schedule parsing
This commit is contained in:
@@ -13,6 +13,18 @@ describe("cron schedule", () => {
|
||||
expect(next).toBe(Date.parse("2025-12-17T17:00:00.000Z"));
|
||||
});
|
||||
|
||||
it("throws a clear error when cron expr is missing at runtime", () => {
|
||||
const nowMs = Date.parse("2025-12-13T00:00:00.000Z");
|
||||
expect(() =>
|
||||
computeNextRunAtMs(
|
||||
{
|
||||
kind: "cron",
|
||||
} as unknown as { kind: "cron"; expr: string; tz?: string },
|
||||
nowMs,
|
||||
),
|
||||
).toThrow("invalid cron schedule: expr is required");
|
||||
});
|
||||
|
||||
it("computes next run for every schedule", () => {
|
||||
const anchor = Date.parse("2025-12-13T00:00:00.000Z");
|
||||
const now = anchor + 10_000;
|
||||
|
||||
Reference in New Issue
Block a user