fix: update EventDisplay and EventRepetition tests
- Fix formatLocalDateTime import in EventDisplay.tsx (now in EventFormFields) - Update test expectations: 'Edit Event' -> 'Update Event' - Remove getEventAsync spy (no longer called before modal opens)
This commit is contained in:
committed by
Benoit TELLIER
parent
6433086332
commit
9ff8354950
@@ -478,18 +478,6 @@ describe("Event Preview Display", () => {
|
|||||||
expect(updatedEvent.attendee[0].partstat).toBe("DECLINED");
|
expect(updatedEvent.attendee[0].partstat).toBe("DECLINED");
|
||||||
});
|
});
|
||||||
it("handles Edit click", async () => {
|
it("handles Edit click", async () => {
|
||||||
const spy = jest
|
|
||||||
.spyOn(eventThunks, "getEventAsync")
|
|
||||||
.mockImplementation((payload) => {
|
|
||||||
return () =>
|
|
||||||
Promise.resolve({
|
|
||||||
calId: payload.calId,
|
|
||||||
event:
|
|
||||||
preloadedState.calendars.list["667037022b752d0026472254/cal1"]
|
|
||||||
.events["event1"],
|
|
||||||
}) as any;
|
|
||||||
});
|
|
||||||
|
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<EventPreviewModal
|
<EventPreviewModal
|
||||||
open={true}
|
open={true}
|
||||||
@@ -503,8 +491,7 @@ describe("Event Preview Display", () => {
|
|||||||
fireEvent.click(screen.getByTestId("EditIcon"));
|
fireEvent.click(screen.getByTestId("EditIcon"));
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(screen.getByText("Update Event")).toBeInTheDocument();
|
||||||
expect(screen.getByText("Edit Event")).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("properly render message button when MAIL_SPA_URL is not null and event has attendees", () => {
|
it("properly render message button when MAIL_SPA_URL is not null and event has attendees", () => {
|
||||||
|
|||||||
@@ -985,19 +985,6 @@ describe("Recurrence Event Behavior Tests", () => {
|
|||||||
|
|
||||||
describe("Calendar Integration - EditModeDialog Flow", () => {
|
describe("Calendar Integration - EditModeDialog Flow", () => {
|
||||||
it("passes correct eventId when editing all instances from preview", async () => {
|
it("passes correct eventId when editing all instances from preview", async () => {
|
||||||
const getEventSpy = jest
|
|
||||||
.spyOn(eventThunks, "getEventAsync")
|
|
||||||
.mockImplementation((payload) => {
|
|
||||||
return () =>
|
|
||||||
Promise.resolve({
|
|
||||||
calId: payload.calId,
|
|
||||||
event:
|
|
||||||
basePreloadedState.calendars.list[
|
|
||||||
"667037022b752d0026472254/cal1"
|
|
||||||
].events["recurring-base/20250315T100000"],
|
|
||||||
}) as any;
|
|
||||||
});
|
|
||||||
|
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<EventPreviewModal
|
<EventPreviewModal
|
||||||
open={true}
|
open={true}
|
||||||
@@ -1022,9 +1009,8 @@ describe("Recurrence Event Behavior Tests", () => {
|
|||||||
fireEvent.click(screen.getByText("Ok"));
|
fireEvent.click(screen.getByText("Ok"));
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(getEventSpy).toHaveBeenCalled();
|
// Update modal should open
|
||||||
// Full display modal should open with the first instance of the series
|
expect(screen.getByText("Update Event")).toBeInTheDocument();
|
||||||
expect(screen.getByText("Edit Event")).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import {
|
|||||||
import { Calendars } from "../Calendars/CalendarTypes";
|
import { Calendars } from "../Calendars/CalendarTypes";
|
||||||
import { userAttendee } from "../User/userDataTypes";
|
import { userAttendee } from "../User/userDataTypes";
|
||||||
import { getEvent } from "./EventApi";
|
import { getEvent } from "./EventApi";
|
||||||
import { formatLocalDateTime } from "./EventModal";
|
import { formatLocalDateTime } from "../../components/Event/EventFormFields";
|
||||||
import { CalendarEvent, RepetitionObject } from "./EventsTypes";
|
import { CalendarEvent, RepetitionObject } from "./EventsTypes";
|
||||||
|
|
||||||
export default function EventDisplayModal({
|
export default function EventDisplayModal({
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ import {
|
|||||||
import AvatarGroup from "@mui/material/AvatarGroup";
|
import AvatarGroup from "@mui/material/AvatarGroup";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
import {
|
import { deleteEventAsync, getEventAsync } from "../Calendars/CalendarSlice";
|
||||||
deleteEventAsync,
|
|
||||||
getEventAsync,
|
|
||||||
} from "../Calendars/CalendarSlice";
|
|
||||||
import { dlEvent } from "./EventApi";
|
import { dlEvent } from "./EventApi";
|
||||||
import EventDisplayModal from "./EventDisplay";
|
import EventDisplayModal from "./EventDisplay";
|
||||||
import EventUpdateModal from "./EventUpdateModal";
|
import EventUpdateModal from "./EventUpdateModal";
|
||||||
import ResponsiveDialog from "../../components/Dialog/ResponsiveDialog";
|
import ResponsiveDialog from "../../components/Dialog/ResponsiveDialog";
|
||||||
import { EditModeDialog } from "../../components/Event/EditModeDialog";
|
import { EditModeDialog } from "../../components/Event/EditModeDialog";
|
||||||
import EventDuplication from "../../components/Event/EventDuplicate";
|
import EventDuplication from "../../components/Event/EventDuplicate";
|
||||||
import { handleDelete, handleRSVP } from "../../components/Event/eventHandlers/eventHandlers";
|
import {
|
||||||
|
handleDelete,
|
||||||
|
handleRSVP,
|
||||||
|
} from "../../components/Event/eventHandlers/eventHandlers";
|
||||||
import { InfoRow } from "../../components/Event/InfoRow";
|
import { InfoRow } from "../../components/Event/InfoRow";
|
||||||
import { renderAttendeeBadge } from "../../components/Event/utils/eventUtils";
|
import { renderAttendeeBadge } from "../../components/Event/utils/eventUtils";
|
||||||
export default function EventPreviewModal({
|
export default function EventPreviewModal({
|
||||||
|
|||||||
Reference in New Issue
Block a user