forked from GitHubMirrors/silverbullet-icalendar
fix(icalendar): Implement recursive RRULE value formatting
This commit is contained in:
@@ -226,7 +226,7 @@ Deno.test("expandRecurrences - object rrule with until", () => {
|
||||
});
|
||||
|
||||
|
||||
Deno.test("expandRecurrences - object rrule with byday (Reproduction)", () => {
|
||||
Deno.test("expandRecurrences - object rrule with byday", () => {
|
||||
const now = new Date();
|
||||
const start = new Date(now.getTime() - 10 * 86400000);
|
||||
const startStr = localDateString(start);
|
||||
@@ -237,22 +237,9 @@ Deno.test("expandRecurrences - object rrule with byday (Reproduction)", () => {
|
||||
rrule: { frequency: "WEEKLY", byday: [{ day: "MO" }, { day: "WE" }] }
|
||||
};
|
||||
|
||||
// Spy on console.error
|
||||
let errorLogged = false;
|
||||
const originalConsoleError = console.error;
|
||||
console.error = (...args) => {
|
||||
if (args[0].includes("Error expanding recurrence for Object RRULE BYDAY Event") &&
|
||||
args[1].message.includes("Invalid weekday string: [object Object]")) {
|
||||
errorLogged = true;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
expandRecurrences(icsEvent, 30);
|
||||
} finally {
|
||||
console.error = originalConsoleError;
|
||||
}
|
||||
|
||||
assert(errorLogged, "Should have logged an error for invalid BYDAY object values");
|
||||
const results = expandRecurrences(icsEvent, 30);
|
||||
// Should now return multiple occurrences
|
||||
assert(results.length > 1, `Expected > 1 occurrences, got ${results.length}`);
|
||||
assertEquals(results[0].recurrent, true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user