test(plugins): make compat window guard type-safe

This commit is contained in:
Vincent Koc
2026-04-26 02:52:45 -07:00
parent bb2425e612
commit 9f0cd3514c

View File

@@ -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);
}