forked from GitHubMirrors/silverbullet-icalendar
test(icalendar): Add reproduction test for UNTIL object mismatch
This commit is contained in:
@@ -206,3 +206,35 @@ Deno.test("expandRecurrences - object rrule (Reproduction of missing events)", (
|
||||
assert(!warningLogged, "Should NOT have logged a warning for object rrule");
|
||||
});
|
||||
|
||||
|
||||
Deno.test("expandRecurrences - object rrule with until (Reproduction)", () => {
|
||||
const now = new Date();
|
||||
const start = new Date(now.getTime() - 10 * 86400000);
|
||||
const startStr = localDateString(start);
|
||||
const untilDate = new Date(now.getTime() + 10 * 86400000);
|
||||
|
||||
const icsEvent = {
|
||||
summary: "Object RRULE UNTIL Event",
|
||||
start: startStr,
|
||||
rrule: { frequency: "DAILY", until: { date: untilDate } } // Common ts-ics structure
|
||||
};
|
||||
|
||||
// Spy on console.error
|
||||
let errorLogged = false;
|
||||
const originalConsoleError = console.error;
|
||||
console.error = (...args) => {
|
||||
if (args[0].includes("Error expanding recurrence for Object RRULE UNTIL Event") &&
|
||||
args[1].message.includes("Invalid UNTIL value")) {
|
||||
errorLogged = true;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
expandRecurrences(icsEvent, 30);
|
||||
} finally {
|
||||
console.error = originalConsoleError;
|
||||
}
|
||||
|
||||
assert(errorLogged, "Should have logged an error for invalid UNTIL object value");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user