Refactor imports (#470)

This commit is contained in:
Camille Moussu
2026-01-20 17:33:30 +01:00
committed by GitHub
parent aeb8670895
commit 23d50f250d
149 changed files with 1439 additions and 1374 deletions
+18 -18
View File
@@ -1,15 +1,14 @@
import CalendarApp from "@/components/Calendar/Calendar";
import CalendarLayout from "@/components/Calendar/CalendarLayout";
import * as calendarDetailThunks from "@/features/Calendars/services";
import * as servicesModule from "@/features/Calendars/services";
import { searchUsers } from "@/features/User/userAPI";
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
import CalendarApp from "../../src/components/Calendar/Calendar";
import * as eventThunks from "../../src/features/Calendars/CalendarSlice";
import { renderWithProviders } from "../utils/Renderwithproviders";
import { searchUsers } from "../../src/features/User/userAPI";
import * as calendarDetailThunks from "../../src/features/Calendars/services/getCalendarDetailAsync";
import { useRef } from "react";
import userEvent from "@testing-library/user-event";
import CalendarLayout from "../../src/components/Calendar/CalendarLayout";
jest.mock("../../src/features/User/userAPI");
import { useRef } from "react";
import { renderWithProviders } from "../utils/Renderwithproviders";
jest.mock("@/features/User/userAPI");
const mockedSearchUsers = searchUsers as jest.MockedFunction<
typeof searchUsers
>;
@@ -348,7 +347,7 @@ describe("calendar Availability search", () => {
it("imports temporary calendars when selecting new users", async () => {
const spy = jest
.spyOn(eventThunks, "getTempCalendarsListAsync")
.spyOn(servicesModule, "getTempCalendarsListAsync")
.mockImplementation((payload) => {
return () => Promise.resolve(payload) as any;
});
@@ -389,7 +388,7 @@ describe("calendar Availability search", () => {
},
]);
const spy = jest
.spyOn(eventThunks, "getTempCalendarsListAsync")
.spyOn(servicesModule, "getTempCalendarsListAsync")
.mockImplementation((payload) => {
return () => Promise.resolve(payload) as any;
});
@@ -411,7 +410,7 @@ describe("calendar Availability search", () => {
it("open window with attendees filled after temp search on create event button click", async () => {
const spy = jest
.spyOn(eventThunks, "getTempCalendarsListAsync")
.spyOn(servicesModule, "getTempCalendarsListAsync")
.mockImplementation((payload) => {
return () => Promise.resolve(payload) as any;
});
@@ -455,7 +454,7 @@ describe("calendar Availability search", () => {
it("open window with attendees filled after temp search on enter in temp input", async () => {
const spy = jest
.spyOn(eventThunks, "getTempCalendarsListAsync")
.spyOn(servicesModule, "getTempCalendarsListAsync")
.mockImplementation((payload) => {
return () => Promise.resolve(payload) as any;
});
@@ -696,10 +695,10 @@ describe("calendar Availability search", () => {
);
const selectedCalls = spy.mock.calls.filter(
(call) => call[0].calId === "user1/cal1"
(call: { calId: string }[]) => call[0].calId === "user1/cal1"
);
const hiddenCalls = spy.mock.calls.filter(
(call) =>
(call: { calId: string }[]) =>
call[0].calId === "user1/cal2" || call[0].calId === "user1/cal3"
);
@@ -729,12 +728,13 @@ describe("calendar Availability search", () => {
);
const callsForCal1 = spy.mock.calls.filter(
(call) => call[0].calId === "user1/cal1"
(call: { calId: string }[]) => call[0].calId === "user1/cal1"
);
const uniqueRanges = new Set(
callsForCal1.map(
(call) => `${call[0].match.start}_${call[0].match.end}`
(call: { match: { end: string; start: string } }[]) =>
`${call[0].match.start}_${call[0].match.end}`
)
);