diff --git a/__test__/features/Events/EventDisplay.test.tsx b/__test__/features/Events/EventDisplay.test.tsx index 59d15c3..7f9d361 100644 --- a/__test__/features/Events/EventDisplay.test.tsx +++ b/__test__/features/Events/EventDisplay.test.tsx @@ -33,7 +33,7 @@ describe("Event Display", () => { list: { "667037022b752d0026472254/cal1": { id: "667037022b752d0026472254/cal1", - name: "Calendar 1", + name: "Calendar", color: "#FF0000", events: { event1: { @@ -94,7 +94,7 @@ describe("Event Display", () => { ).toBeInTheDocument(); expect(screen.getByText(/\d{2}:\d{2} – \d{2}:\d{2}/)).toBeInTheDocument(); - expect(screen.getByText("Calendar 1")).toBeInTheDocument(); + expect(screen.getByText("Calendar")).toBeInTheDocument(); }); it("calls onClose when Cancel clicked", () => { renderWithProviders( diff --git a/__test__/features/Events/eventUtils.test.ts b/__test__/features/Events/eventUtils.test.ts index 0c1a23f..44bc8a5 100644 --- a/__test__/features/Events/eventUtils.test.ts +++ b/__test__/features/Events/eventUtils.test.ts @@ -147,7 +147,7 @@ describe("calendarEventToJCal", () => { repetition: "WEEKLY", organizer: { cn: "Alice", - cal_address: "mailto:alice@example.com", + cal_address: "alice@example.com", }, attendee: [ { @@ -156,7 +156,7 @@ describe("calendarEventToJCal", () => { rsvp: "TRUE", role: "REQ-PARTICIPANT", cutype: "INDIVIDUAL", - cal_address: "mailto:bob@example.com", + cal_address: "bob@example.com", }, ], }; @@ -173,8 +173,13 @@ describe("calendarEventToJCal", () => { ["uid", {}, "text", "event-123"], ["summary", {}, "text", "Team Meeting"], ["transp", {}, "text", "OPAQUE"], - ["dtstart", { tzid: "Europe/Paris" }, "date-time", "20250723T100000"], - ["dtend", { tzid: "Europe/Paris" }, "date-time", "20250723T110000"], + [ + "dtstart", + { tzid: "Europe/Paris" }, + "date-time", + "2025-07-23T10:00:00", + ], + ["dtend", { tzid: "Europe/Paris" }, "date-time", "2025-07-23T11:00:00"], ["class", {}, "text", "PUBLIC"], ["location", {}, "text", "Room 101"], ["description", {}, "text", "Discuss project roadmap."], @@ -253,7 +258,7 @@ describe("calendarEventToJCal", () => { repetition: "WEEKLY", organizer: { cn: "Alice", - cal_address: "mailto:alice@example.com", + cal_address: "alice@example.com", }, attendee: [ { @@ -262,7 +267,7 @@ describe("calendarEventToJCal", () => { rsvp: "TRUE", role: "REQ-PARTICIPANT", cutype: "INDIVIDUAL", - cal_address: "mailto:bob@example.com", + cal_address: "bob@example.com", }, ], }; diff --git a/src/features/Events/eventUtils.ts b/src/features/Events/eventUtils.ts index ecdc76e..a592970 100644 --- a/src/features/Events/eventUtils.ts +++ b/src/features/Events/eventUtils.ts @@ -125,7 +125,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] { "organizer", { cn: event.organizer.cn }, "cal-address", - event.organizer.cal_address, + `mailto:${event.organizer.cal_address}`, ]); } if (event.location) { @@ -149,7 +149,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] { cutype: att.cutype, }, "cal-address", - att.cal_address, + `mailto:${att.cal_address}`, ]); }); @@ -160,7 +160,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] { return ["vcalendar", [], [vevent, vtimezone.component.jCal]]; } function formatDateToICal(date: Date, allday: Boolean) { - // Format date like: 20250214T110000 (local time) + // Format date like: 2025-02-14T11:00:00 (local time) const pad = (n: number) => n.toString().padStart(2, "0"); const year = date.getFullYear(); @@ -172,5 +172,5 @@ function formatDateToICal(date: Date, allday: Boolean) { if (allday) { return `${year}-${month}-${day}`; } - return `${year}${month}${day}T${hours}${minutes}${seconds}`; + return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`; } diff --git a/src/features/User/userSlice.ts b/src/features/User/userSlice.ts index 4f186bb..a690407 100644 --- a/src/features/User/userSlice.ts +++ b/src/features/User/userSlice.ts @@ -24,7 +24,7 @@ export const userSlice = createSlice({ if (!state.organiserData) { state.organiserData = {} as userOrganiser; } - state.organiserData.cn = action.payload.sub; + state.organiserData.cn = action.payload.name; state.organiserData.cal_address = `mailto:${action.payload.email}`; }, setTokens: (state, action) => {