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:
lenhanphung
2025-10-08 13:21:19 +07:00
committed by Benoit TELLIER
parent 6433086332
commit 9ff8354950
4 changed files with 9 additions and 36 deletions
+1 -14
View File
@@ -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();
});
});
});