From 9f0cd3514c6766f088a39ab8637bf64da7f796b8 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 26 Apr 2026 02:52:45 -0700 Subject: [PATCH] test(plugins): make compat window guard type-safe --- src/plugins/compat/registry.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/compat/registry.test.ts b/src/plugins/compat/registry.test.ts index f15b8e439c5..b308f0491a4 100644 --- a/src/plugins/compat/registry.test.ts +++ b/src/plugins/compat/registry.test.ts @@ -35,8 +35,12 @@ describe("plugin compatibility registry", () => { expect(record.deprecated, record.code).toMatch(datePattern); expect(record.warningStarts, record.code).toMatch(datePattern); expect(record.removeAfter, record.code).toMatch(datePattern); + if (!record.warningStarts || !record.removeAfter) { + throw new Error(`${record.code} is missing deprecation window dates`); + } const maxRemoveAfter = addUtcMonths(parseDate(record.warningStarts), 3); - expect(parseDate(record.removeAfter) <= maxRemoveAfter, record.code).toBe(true); + const removeAfter = parseDate(record.removeAfter); + expect(removeAfter <= maxRemoveAfter, record.code).toBe(true); expect(record.replacement, record.code).toBeTruthy(); expect(record.docsPath, record.code).toMatch(/^\//u); }