Skip to content

Commit 492e2cc

Browse files
test(calendar): fix hardcoded date in event shape test
Replace the fixed 2026-03-10 date with a relative date (tomorrow) so the test doesn't silently fail once the date has passed. firstYear is now derived dynamically from the generated start date.
1 parent 0ca91f7 commit 492e2cc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/unit/modules/default/calendar/calendar_fetcher_utils_spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,9 @@ END:VCALENDAR`);
238238
});
239239

240240
it("should produce a correctly shaped event object with all required fields", () => {
241-
const start = moment("2026-03-10T14:00:00").toDate();
242-
const end = moment("2026-03-10T15:00:00").toDate();
241+
const start = moment().add(1, "day").startOf("hour").toDate();
242+
const end = moment().add(1, "day").startOf("hour").add(1, "hour")
243+
.toDate();
243244

244245
const filteredEvents = CalendarFetcherUtils.filterEvents(
245246
{
@@ -266,7 +267,7 @@ END:VCALENDAR`);
266267
expect(ev.fullDayEvent).toBe(false);
267268
expect(ev.recurringEvent).toBe(false);
268269
expect(ev.class).toBe("PUBLIC");
269-
expect(ev.firstYear).toBe(2026);
270+
expect(ev.firstYear).toBe(moment(start).year());
270271
expect(ev.location).toBe("Room 42");
271272
expect(ev.geo).toEqual({ lat: 52.52, lon: 13.4 });
272273
expect(ev.description).toBe("Agenda TBD");

0 commit comments

Comments
 (0)