From b38c61bd749835225b9354739811962ec5729832 Mon Sep 17 00:00:00 2001 From: repo-worker-code-g Date: Fri, 6 Nov 2026 23:49:23 -0600 Subject: [PATCH] test(aggregator): normalizeResetAt impossible/non-ISO date regressions (#4968) The behaviour already landed in 96c43b5e86 (#2579): the string branch uses parseIsoDate. These are the acceptance regression tests for the refused cases (2026-02-30, 2026-04-31, 2026-02-29, March 2 2026 -> null) and the passing controls (date-only, leap day). bun test quota-gather-map + clinepass-adapter + feed: 149 pass, 0 fail. --- pm-stack/aggregator/test/quota-gather-map.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pm-stack/aggregator/test/quota-gather-map.test.ts b/pm-stack/aggregator/test/quota-gather-map.test.ts index 0288b594e3..e1312fbf2c 100644 --- a/pm-stack/aggregator/test/quota-gather-map.test.ts +++ b/pm-stack/aggregator/test/quota-gather-map.test.ts @@ -59,6 +59,16 @@ describe("normalizeResetAt", () => { expect(normalizeResetAt(null)).toBeNull(); expect(normalizeResetAt(0)).toBeNull(); }); + test("impossible and non-ISO date strings are null (#4968)", () => { + expect(normalizeResetAt("2026-02-30")).toBeNull(); + expect(normalizeResetAt("2026-04-31")).toBeNull(); + expect(normalizeResetAt("2026-02-29")).toBeNull(); // 2026 is not a leap year + expect(normalizeResetAt("March 2, 2026")).toBeNull(); + }); + test("valid date-only and leap-day strings pass (#4968)", () => { + expect(normalizeResetAt("2026-03-02")).toBe("2026-03-02T00:00:00.000Z"); + expect(normalizeResetAt("2024-02-29")).toBe("2024-02-29T00:00:00.000Z"); + }); }); describe("entryFromResult", () => {