2023-07-19 15:22:41 +00:00
|
|
|
import matchers from "@testing-library/jest-dom/matchers";
|
|
|
|
import { cleanup } from "@testing-library/react";
|
2023-07-27 13:48:23 +00:00
|
|
|
import { afterEach, expect, vi } from "vitest";
|
|
|
|
|
2023-08-18 08:52:14 +00:00
|
|
|
vi.mock("next-auth/react", () => ({
|
|
|
|
useSession() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@calcom/features/ee/organizations/hooks", () => ({
|
|
|
|
useOrgBrandingValues() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@calcom/features/ee/organizations/context/provider", () => ({
|
|
|
|
useOrgBranding() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("@calcom/trpc/react", () => ({
|
|
|
|
trpc: {},
|
|
|
|
}));
|
|
|
|
|
|
|
|
vi.mock("next/navigation", async () => ({
|
|
|
|
...((await vi.importActual("next/navigation")) as object),
|
|
|
|
useRouter() {
|
|
|
|
return {
|
|
|
|
route: "/",
|
|
|
|
pathname: "",
|
|
|
|
query: {},
|
|
|
|
asPath: "",
|
|
|
|
push: vi.fn(),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
useSearchParams() {
|
|
|
|
return new URLSearchParams();
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
2023-07-27 13:48:23 +00:00
|
|
|
vi.mock("@calcom/lib/OgImages", async () => {
|
|
|
|
return {};
|
|
|
|
});
|
|
|
|
|
|
|
|
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
|
|
observe: vi.fn(),
|
|
|
|
unobserve: vi.fn(),
|
|
|
|
disconnect: vi.fn(),
|
|
|
|
}));
|
2023-07-19 15:22:41 +00:00
|
|
|
|
|
|
|
expect.extend(matchers);
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
cleanup();
|
|
|
|
});
|