mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:17:40 +00:00
Cron: guard missing expr in schedule parsing
This commit is contained in:
@@ -186,4 +186,19 @@ describe("cron schedule error isolation", () => {
|
||||
expect(badJob.state.lastError).toMatch(/^schedule error:/);
|
||||
expect(badJob.state.lastError).toBeTruthy();
|
||||
});
|
||||
|
||||
it("records a clear schedule error when cron expr is missing", () => {
|
||||
const badJob = createJob({
|
||||
id: "missing-expr",
|
||||
name: "Missing Expr",
|
||||
schedule: { kind: "cron" } as unknown as CronJob["schedule"],
|
||||
});
|
||||
const state = createMockState([badJob]);
|
||||
|
||||
recomputeNextRuns(state);
|
||||
|
||||
expect(badJob.state.lastError).toContain("invalid cron schedule: expr is required");
|
||||
expect(badJob.state.lastError).not.toContain("Cannot read properties of undefined");
|
||||
expect(badJob.state.scheduleErrorCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user