Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { screen, fireEvent, waitFor } from "@testing-library/react";
|
||||
import CalendarPopover from "../../../src/components/Calendar/CalendarModal";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import { Calendars } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { getSecretLink } from "../../../src/features/Calendars/CalendarApi";
|
||||
|
||||
jest.mock("../../../src/features/Calendars/CalendarApi", () => ({
|
||||
@@ -103,7 +103,7 @@ describe("CalendarPopover (editing mode)", () => {
|
||||
},
|
||||
};
|
||||
|
||||
const existingCalendar: Calendars = {
|
||||
const existingCalendar: Calendar = {
|
||||
id: "user1/cal1",
|
||||
link: "/calendars/user/cal1",
|
||||
name: "Work Calendar",
|
||||
@@ -208,7 +208,7 @@ describe("CalendarPopover - Tabs Scenarios", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const existingCalendar: Calendars = {
|
||||
const existingCalendar: Calendar = {
|
||||
id: "user1/cal1",
|
||||
link: "/calendars/user1/cal1.json",
|
||||
name: "Work Calendar",
|
||||
|
||||
@@ -22,7 +22,7 @@ import * as calAPI from "../../../src/features/Calendars/CalendarApi";
|
||||
import * as userAPI from "../../../src/features/User/userAPI";
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { Calendars } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
|
||||
jest.mock("../../../src/features/Calendars/CalendarApi");
|
||||
@@ -79,7 +79,7 @@ describe("CalendarSlice", () => {
|
||||
[calId]: {
|
||||
id: calId,
|
||||
events: { e1: { uid: "e1" } },
|
||||
} as unknown as Calendars,
|
||||
} as unknown as Calendar,
|
||||
},
|
||||
};
|
||||
const state = reducer(
|
||||
@@ -97,7 +97,7 @@ describe("CalendarSlice", () => {
|
||||
[calId]: {
|
||||
id: calId,
|
||||
events: { e1: { uid: "e1", title: "Old" } },
|
||||
} as unknown as Calendars,
|
||||
} as unknown as Calendar,
|
||||
},
|
||||
};
|
||||
const state = reducer(
|
||||
@@ -276,7 +276,7 @@ describe("CalendarSlice", () => {
|
||||
id: "u1/cal1",
|
||||
name: "Existing Calendar",
|
||||
events: {},
|
||||
} as Calendars,
|
||||
} as Calendar,
|
||||
};
|
||||
|
||||
const store = storeFactory();
|
||||
@@ -447,7 +447,7 @@ describe("CalendarSlice", () => {
|
||||
[calId]: {
|
||||
id: calId,
|
||||
events: { e1: { uid: "e1" } },
|
||||
} as unknown as Calendars,
|
||||
} as unknown as Calendar,
|
||||
},
|
||||
};
|
||||
const state = reducer(
|
||||
@@ -473,7 +473,7 @@ describe("CalendarSlice", () => {
|
||||
ownerEmails: ["o@o.com"],
|
||||
link: "/calendars/t1.json",
|
||||
description: "desc",
|
||||
} as Calendars,
|
||||
} as Calendar,
|
||||
};
|
||||
const state = reducer(
|
||||
initialState,
|
||||
@@ -533,7 +533,7 @@ describe("CalendarSlice", () => {
|
||||
["c1"]: {
|
||||
id: "c1",
|
||||
events: {},
|
||||
} as unknown as Calendars,
|
||||
} as unknown as Calendar,
|
||||
},
|
||||
},
|
||||
getCalendarDetailAsync.fulfilled(payload, "req11", {
|
||||
|
||||
@@ -300,13 +300,13 @@ describe("Event Preview Display", () => {
|
||||
screen.getByText("eventPreview.attendingQuestion")
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("button", { name: "eventPreview.accept" })
|
||||
screen.getByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("button", { name: "eventPreview.maybe" })
|
||||
screen.getByRole("button", { name: "eventPreview.TENTATIVE" })
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("button", { name: "eventPreview.decline" })
|
||||
screen.getByRole("button", { name: "eventPreview.DECLINED" })
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
it("doesnt renders RSVP buttons when user isnt an attendee", () => {
|
||||
@@ -354,13 +354,13 @@ describe("Event Preview Display", () => {
|
||||
screen.queryByText("eventPreview.attendingQuestion")
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "eventPreview.accept" })
|
||||
screen.queryByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "eventPreview.maybe" })
|
||||
screen.queryByRole("button", { name: "eventPreview.TENTATIVE" })
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "eventPreview.decline" })
|
||||
screen.queryByRole("button", { name: "eventPreview.DECLINED" })
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -414,7 +414,7 @@ describe("Event Preview Display", () => {
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.accept" })
|
||||
screen.getByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -474,7 +474,9 @@ describe("Event Preview Display", () => {
|
||||
rsvpState
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "eventPreview.maybe" }));
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.TENTATIVE" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(spy).toHaveBeenCalled();
|
||||
@@ -534,7 +536,7 @@ describe("Event Preview Display", () => {
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.decline" })
|
||||
screen.getByRole("button", { name: "eventPreview.DECLINED" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -1020,7 +1022,7 @@ describe("Event Preview Display", () => {
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("displays only maybe count when all attendees tentative", () => {
|
||||
it("displays only TENTATIVE count when all attendees tentative", () => {
|
||||
const attendees = [
|
||||
{
|
||||
cn: "organizer",
|
||||
@@ -1262,7 +1264,7 @@ describe("Event Preview Display", () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("displays correct counts with multiple yes and maybe", () => {
|
||||
it("displays correct counts with multiple yes and TENTATIVE", () => {
|
||||
const attendees = [
|
||||
{
|
||||
cn: "Guest 1",
|
||||
|
||||
@@ -258,7 +258,7 @@ describe("EventPopover", () => {
|
||||
{
|
||||
cn: "John Doe",
|
||||
cal_address: "john@example.com",
|
||||
partstat: "NEED_ACTION",
|
||||
partstat: "NEEDS-ACTION",
|
||||
rsvp: "FALSE",
|
||||
role: "REQ-PARTICIPANT",
|
||||
cutype: "INDIVIDUAL",
|
||||
|
||||
@@ -315,7 +315,7 @@ describe("EventPreviewModal - Recurring Event Interactions", () => {
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.accept" })
|
||||
screen.getByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -505,7 +505,7 @@ describe("RSVP to Recurring Event", () => {
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.accept" })
|
||||
screen.getByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -543,7 +543,7 @@ describe("RSVP to Recurring Event", () => {
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getByRole("button", { name: "eventPreview.accept" })
|
||||
screen.getByRole("button", { name: "eventPreview.ACCEPTED" })
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -975,8 +975,7 @@ describe("handleRSVP function", () => {
|
||||
basePreloadedState.calendars.list["667037022b752d0026472254/cal1"],
|
||||
basePreloadedState.user,
|
||||
nonRecurringEvent,
|
||||
"ACCEPTED",
|
||||
mockOnClose
|
||||
"ACCEPTED"
|
||||
);
|
||||
|
||||
expect(mockDispatch).toHaveBeenCalled();
|
||||
|
||||
@@ -13,7 +13,7 @@ import EventUpdateModal from "../../../src/features/Events/EventUpdateModal";
|
||||
import CalendarLayout from "../../../src/components/Calendar/CalendarLayout";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import { SpiedFunction } from "jest-mock";
|
||||
import { Calendars } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("Update tempcalendars called with correct params", () => {
|
||||
let refreshCalendarsSpy: SpiedFunction<
|
||||
(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
calendars: Calendars[],
|
||||
calendars: Calendar[],
|
||||
calendarRange: { start: Date; end: Date },
|
||||
calType?: "temp"
|
||||
) => Promise<void>
|
||||
@@ -35,14 +35,14 @@ describe("Update tempcalendars called with correct params", () => {
|
||||
let refreshSingularCalendarSpy: SpiedFunction<
|
||||
(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
calendar: Calendars,
|
||||
calendar: Calendar,
|
||||
calendarRange: { start: Date; end: Date },
|
||||
calType?: "temp"
|
||||
) => Promise<void>
|
||||
>;
|
||||
let updateTempCalendarSpy: SpiedFunction<
|
||||
(
|
||||
tempcalendars: Record<string, Calendars>,
|
||||
tempcalendars: Record<string, Calendar>,
|
||||
event: CalendarEvent,
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
calendarRange: { start: Date; end: Date }
|
||||
|
||||
@@ -71,9 +71,9 @@ describe("parseCalendarEvent", () => {
|
||||
cn: "Bob",
|
||||
cal_address: "bob@example.com",
|
||||
partstat: "ACCEPTED",
|
||||
rsvp: "",
|
||||
role: "",
|
||||
cutype: "",
|
||||
cutype: "INDIVIDUAL",
|
||||
role: "REQ-PARTICIPANT",
|
||||
rsvp: "FALSE",
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -133,9 +133,9 @@ describe("parseCalendarEvent", () => {
|
||||
cn: "Bob",
|
||||
cal_address: "bob@example.com",
|
||||
partstat: "ACCEPTED",
|
||||
rsvp: "",
|
||||
role: "",
|
||||
cutype: "",
|
||||
cutype: "INDIVIDUAL",
|
||||
role: "REQ-PARTICIPANT",
|
||||
rsvp: "FALSE",
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -285,10 +285,10 @@ describe("parseCalendarEvent", () => {
|
||||
{
|
||||
cn: "",
|
||||
cal_address: "john@example.com",
|
||||
partstat: "",
|
||||
rsvp: "",
|
||||
role: "",
|
||||
cutype: "",
|
||||
partstat: "NEEDS-ACTION",
|
||||
cutype: "INDIVIDUAL",
|
||||
role: "REQ-PARTICIPANT",
|
||||
rsvp: "FALSE",
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user