fix: centralize cron schedule number coercion · openclaw/openclaw@b779bdb
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { cronSchedulingInputsEqual, tryCronScheduleIdentity } from "./schedule-identity.js"; |
| 3 | + |
| 4 | +describe("tryCronScheduleIdentity", () => { |
| 5 | +it("normalizes numeric schedule strings like execution does", () => { |
| 6 | +const numeric = tryCronScheduleIdentity({ |
| 7 | +enabled: true, |
| 8 | +schedule: { kind: "every", everyMs: 60_000, anchorMs: 123 }, |
| 9 | +}); |
| 10 | +const stringNumeric = tryCronScheduleIdentity({ |
| 11 | +enabled: true, |
| 12 | +schedule: { kind: "every", everyMs: "60000", anchorMs: "123" }, |
| 13 | +}); |
| 14 | + |
| 15 | +expect(stringNumeric).toBe(numeric); |
| 16 | +expect( |
| 17 | +cronSchedulingInputsEqual( |
| 18 | +{ schedule: { kind: "every", everyMs: 60_000, anchorMs: 123 } }, |
| 19 | +{ schedule: { kind: "every", everyMs: "60000", anchorMs: "123" } }, |
| 20 | +), |
| 21 | +).toBe(true); |
| 22 | +}); |
| 23 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。