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");
|
||||
});
|
||||
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(
|
||||
<EventPreviewModal
|
||||
open={true}
|
||||
@@ -503,8 +491,7 @@ describe("Event Preview Display", () => {
|
||||
fireEvent.click(screen.getByTestId("EditIcon"));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(spy).toHaveBeenCalled();
|
||||
expect(screen.getByText("Edit Event")).toBeInTheDocument();
|
||||
expect(screen.getByText("Update Event")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
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", () => {
|
||||
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(
|
||||
<EventPreviewModal
|
||||
open={true}
|
||||
@@ -1022,9 +1009,8 @@ describe("Recurrence Event Behavior Tests", () => {
|
||||
fireEvent.click(screen.getByText("Ok"));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(getEventSpy).toHaveBeenCalled();
|
||||
// Full display modal should open with the first instance of the series
|
||||
expect(screen.getByText("Edit Event")).toBeInTheDocument();
|
||||
// Update modal should open
|
||||
expect(screen.getByText("Update Event")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ import {
|
||||
import { Calendars } from "../Calendars/CalendarTypes";
|
||||
import { userAttendee } from "../User/userDataTypes";
|
||||
import { getEvent } from "./EventApi";
|
||||
import { formatLocalDateTime } from "./EventModal";
|
||||
import { formatLocalDateTime } from "../../components/Event/EventFormFields";
|
||||
import { CalendarEvent, RepetitionObject } from "./EventsTypes";
|
||||
|
||||
export default function EventDisplayModal({
|
||||
|
||||
@@ -24,17 +24,17 @@ import {
|
||||
import AvatarGroup from "@mui/material/AvatarGroup";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import {
|
||||
deleteEventAsync,
|
||||
getEventAsync,
|
||||
} from "../Calendars/CalendarSlice";
|
||||
import { deleteEventAsync, getEventAsync } from "../Calendars/CalendarSlice";
|
||||
import { dlEvent } from "./EventApi";
|
||||
import EventDisplayModal from "./EventDisplay";
|
||||
import EventUpdateModal from "./EventUpdateModal";
|
||||
import ResponsiveDialog from "../../components/Dialog/ResponsiveDialog";
|
||||
import { EditModeDialog } from "../../components/Event/EditModeDialog";
|
||||
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 { renderAttendeeBadge } from "../../components/Event/utils/eventUtils";
|
||||
export default function EventPreviewModal({
|
||||
|
||||
Reference in New Issue
Block a user