test: cover every schedule anchor boundary

This commit is contained in:
Peter Steinberger
2026-01-02 11:33:49 +01:00
parent 25762c0ac6
commit eda74d3a55

View File

@@ -31,4 +31,13 @@ describe("cron schedule", () => {
// Should return nowMs + everyMs, not nowMs (which would cause infinite loop)
expect(next).toBe(now + 30_000);
});
it("advances when now matches anchor for every schedule", () => {
const anchor = Date.parse("2025-12-13T00:00:00.000Z");
const next = computeNextRunAtMs(
{ kind: "every", everyMs: 30_000, anchorMs: anchor },
anchor,
);
expect(next).toBe(anchor + 30_000);
});
});