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
@@ -1,5 +1,3 @@
// __test__/features/calendars/calendarApi.test.ts
import {
addSharedCalendar,
exportCalendar,
@@ -9,12 +7,12 @@ import {
postCalendar,
proppatchCalendar,
removeCalendar,
} from "../../../src/features/Calendars/CalendarApi";
import { clientConfig } from "../../../src/features/User/oidcAuth";
import { api } from "../../../src/utils/apiUtils";
} from "@/features/Calendars/CalendarApi";
import { clientConfig } from "@/features/User/oidcAuth";
import { api } from "@/utils/apiUtils";
clientConfig.url = "https://example.com";
jest.mock("../../../src/utils/apiUtils");
jest.mock("@/utils/apiUtils");
describe("Calendar API", () => {
afterEach(() => {
@@ -1,11 +1,11 @@
import { screen, fireEvent, waitFor } from "@testing-library/react";
import CalendarPopover from "../../../src/components/Calendar/CalendarModal";
import CalendarPopover from "@/components/Calendar/CalendarModal";
import { getSecretLink } from "@/features/Calendars/CalendarApi";
import { Calendar } from "@/features/Calendars/CalendarTypes";
import * as eventThunks from "@/features/Calendars/services";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import { renderWithProviders } from "../../utils/Renderwithproviders";
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
import { getSecretLink } from "../../../src/features/Calendars/CalendarApi";
jest.mock("../../../src/features/Calendars/CalendarApi", () => ({
jest.mock("@/features/Calendars/CalendarApi", () => ({
getSecretLink: jest.fn(),
}));
@@ -108,7 +108,7 @@ describe("CalendarPopover (editing mode)", () => {
link: "/calendars/user/cal1",
name: "Work Calendar",
description: "Team meetings",
color: "#33B679",
color: { light: "#33B679" },
owner: "alice",
ownerEmails: ["alice@example.com"],
visibility: "public",
@@ -181,7 +181,7 @@ describe("CalendarPopover (editing mode)", () => {
calId: "user1/cal1",
calLink: "/calendars/user/cal1",
patch: {
color: "#33B679",
color: { light: "#33B679" },
desc: "Team meetings",
name: "Updated Calendar",
},
@@ -213,7 +213,7 @@ describe("CalendarPopover - Tabs Scenarios", () => {
link: "/calendars/user1/cal1.json",
name: "Work Calendar",
description: "Team meetings",
color: "#33B679",
color: { light: "#33B679" },
owner: "alice",
ownerEmails: ["alice@example.com"],
visibility: "public",
@@ -1,37 +1,36 @@
import * as calAPI from "@/features/Calendars/CalendarApi";
import reducer, {
addEvent,
removeEvent,
createCalendar,
updateEventLocal,
removeEvent,
removeTempCal,
getTempCalendarsListAsync,
putEventAsync,
updateEventLocal,
} from "@/features/Calendars/CalendarSlice";
import { Calendar } from "@/features/Calendars/CalendarTypes";
import {
addSharedCalendarAsync,
createCalendarAsync,
deleteEventAsync,
getCalendarDetailAsync,
getCalendarsListAsync,
getEventAsync,
patchCalendarAsync,
removeCalendarAsync,
getTempCalendarsListAsync,
moveEventAsync,
patchACLCalendarAsync,
createCalendarAsync,
addSharedCalendarAsync,
deleteEventAsync,
} from "../../../src/features/Calendars/CalendarSlice";
import { getCalendarsListAsync } from "../../../src/features/Calendars/services/getCalendarsListAsync";
import { getCalendarDetailAsync } from "../../../src/features/Calendars/services/getCalendarDetailAsync";
import * as calAPI from "../../../src/features/Calendars/CalendarApi";
import * as userAPI from "../../../src/features/User/userAPI";
patchCalendarAsync,
putEventAsync,
removeCalendarAsync,
} from "@/features/Calendars/services";
import { CalendarEvent } from "@/features/Events/EventsTypes";
import * as userAPI from "@/features/User/userAPI";
import userReducer, { setUserData } from "@/features/User/userSlice";
import { configureStore } from "@reduxjs/toolkit";
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
import { setUserData } from "../../../src/features/User/userSlice";
import userReducer from "../../../src/features/User/userSlice";
jest.mock("../../../src/features/Calendars/CalendarApi");
jest.mock("../../../src/features/User/userAPI");
jest.mock("../../../src/features/Events/EventApi");
jest.mock("../../../src/features/Events/eventUtils");
jest.mock("../../../src/utils/apiUtils");
jest.mock("@/features/Calendars/CalendarApi");
jest.mock("@/features/User/userAPI");
jest.mock("@/features/Events/EventApi");
jest.mock("@/features/Events/eventUtils");
jest.mock("@/utils/apiUtils");
describe("CalendarSlice", () => {
const initialState = {
@@ -1,10 +1,10 @@
import CalendarApp from "@/components/Calendar/Calendar";
import * as calendarUtils from "@/components/Calendar/utils/calendarUtils";
import { updateSlotLabelVisibility } from "@/components/Calendar/utils/calendarUtils";
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
import { CalendarEvent } from "@/features/Events/EventsTypes";
import * as SettingsSlice from "@/features/Settings/SettingsSlice";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import CalendarApp from "../../../src/components/Calendar/Calendar";
import { updateSlotLabelVisibility } from "../../../src/components/Calendar/utils/calendarUtils";
import EventPreviewModal from "../../../src/features/Events/EventDisplayPreview";
import * as SettingsSlice from "../../../src/features/Settings/SettingsSlice";
import * as calendarUtils from "../../../src/components/Calendar/utils/calendarUtils";
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
import { renderWithProviders } from "../../utils/Renderwithproviders";
describe("Calendar - Timezone Integration", () => {
@@ -199,7 +199,6 @@ describe("EventDisplayPreview - Timezone Display", () => {
onClose={mockOnClose}
eventId="allDayEvent"
calId="user1/cal1"
event={allDayEvent}
/>,
baseState
);
@@ -236,7 +235,6 @@ describe("EventDisplayPreview - Timezone Display", () => {
eventId="event1"
calId="user1/cal1"
onClose={mockOnClose}
event={baseEvent}
/>,
state
);
@@ -1,5 +1,5 @@
import { screen, fireEvent, waitFor, cleanup } from "@testing-library/react";
import { TimezoneSelector } from "../../../src/components/Calendar/TimezoneSelector";
import { TimezoneSelector } from "@/components/Calendar/TimezoneSelector";
import { cleanup, fireEvent, screen, waitFor } from "@testing-library/react";
import { renderWithProviders } from "../../utils/Renderwithproviders";
describe("TimezoneSelector", () => {
@@ -1,16 +1,16 @@
import { configureStore } from "@reduxjs/toolkit";
import reducer from "../../../../src/features/Calendars/CalendarSlice";
import * as fetchSyncTokenChanges from "@/features/Calendars/api/fetchSyncTokenChanges";
import reducer from "@/features/Calendars/CalendarSlice";
import { Calendar } from "@/features/Calendars/CalendarTypes";
import {
refreshCalendarWithSyncToken,
SyncTokenUpdates,
} from "../../../../src/features/Calendars/services/refreshCalendar";
import { Calendar } from "../../../../src/features/Calendars/CalendarTypes";
import { CalendarEvent } from "../../../../src/features/Events/EventsTypes";
import * as fetchSyncTokenChanges from "../../../../src/features/Calendars/api/fetchSyncTokenChanges";
import * as EventApi from "../../../../src/features/Events/EventApi";
} from "@/features/Calendars/services/refreshCalendar";
import * as EventApi from "@/features/Events/EventApi";
import { CalendarEvent } from "@/features/Events/EventsTypes";
import { configureStore } from "@reduxjs/toolkit";
jest.mock("../../../../src/features/Calendars/api/fetchSyncTokenChanges");
jest.mock("../../../../src/features/Events/EventApi");
jest.mock("@/features/Calendars/api/fetchSyncTokenChanges");
jest.mock("@/features/Events/EventApi");
describe("refreshCalendarWithSyncToken", () => {
const mockCalendar: Calendar = {