From b5c718f286246dd8193044ca33b8169cd0a4dfe5 Mon Sep 17 00:00:00 2001 From: sstent Date: Fri, 20 Feb 2026 08:30:31 -0800 Subject: [PATCH] test(icalendar): Add reproduction test for non-string rrule --- icalendar_test.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/icalendar_test.ts b/icalendar_test.ts index 7138493..8842f14 100644 --- a/icalendar_test.ts +++ b/icalendar_test.ts @@ -121,4 +121,34 @@ Deno.test("expandRecurrences - custom windowDays", () => { // It should include everything in the last 7 days + next 2 days. // Since it's daily, that's roughly 7 + 2 + 1 = 10 events. assert(results.length >= 3, "Should have at least today and 2 future days"); -}); \ No newline at end of file +}); +Deno.test("expandRecurrences - non-string rrule (Reproduction)", () => { + const now = new Date(); + const startStr = localDateString(now); + + const icsEvent = { + summary: "Bug Reproduction Event", + start: startStr, + rrule: 12345 // Simulating the malformed data + }; + + // Spy on console.error + let errorLogged = false; + const originalConsoleError = console.error; + console.error = (...args) => { + if (args[0].includes("Error expanding recurrence for Bug Reproduction Event") && + args[1] instanceof TypeError) { + errorLogged = true; + } + // originalConsoleError(...args); // Keep silent for test + }; + + try { + expandRecurrences(icsEvent, 30); + } finally { + console.error = originalConsoleError; + } + + assert(errorLogged, "Should have logged an error for non-string rrule"); +}); +