Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Fix flaky test (#1930)

Luke Vellabb654253ae52
diff --git a/apps/web/src/utils/ics.test.ts b/apps/web/src/utils/ics.test.ts
index 705d0cc62..10d03a8c9 100644
--- a/apps/web/src/utils/ics.test.ts
+++ b/apps/web/src/utils/ics.test.ts
@@ -38,7 +38,20 @@ describe("createIcsEvent", () => {
allDay: true,
});
- expect(withTimezone.value).toEqual(withoutTimezone.value);
+ // Extract DTSTART and DTEND from both results
+ const extractDateFields = (icsContent: string) => {
+ const dtstart = icsContent.match(/DTSTART[^:]*:[^\r\n]*/)?.[0];
+ const dtend = icsContent.match(/DTEND[^:]*:[^\r\n]*/)?.[0];
+ return { dtstart, dtend };
+ };
+
+ const withTimezoneFields = extractDateFields(withTimezone.value ?? "");
+ const withoutTimezoneFields = extractDateFields(
+ withoutTimezone.value ?? "",
+ );
+
+ expect(withTimezoneFields.dtstart).toEqual(withoutTimezoneFields.dtstart);
+ expect(withTimezoneFields.dtend).toEqual(withoutTimezoneFields.dtend);
});
it("should handle cross-month boundaries", () => {