1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2025-01-21 22:38:46 +00:00

chore: mock recharts

This commit is contained in:
Anderson Shindy Oki 2025-01-20 17:11:40 +09:00
parent 786d5600ed
commit 9320b26759
2 changed files with 13 additions and 2 deletions

View file

@ -2,10 +2,21 @@
import { http } from "msw";
import { HttpResponse } from "msw";
import { vitest } from "vitest";
import { vi, vitest } from "vitest";
import "@testing-library/jest-dom";
import server from "./mocks/node";
vi.mock("recharts", async () => {
const OriginalRechartsModule = await vi.importActual("recharts");
return {
...OriginalRechartsModule,
ResponsiveContainer: ({ children }: { children: React.ReactNode }) => (
<div style={{ width: "100%", height: "100%" }}>{children}</div>
),
};
});
// From https://stackoverflow.com/questions/39830580/jest-test-fails-typeerror-window-matchmedia-is-not-a-function
Object.defineProperty(window, "matchMedia", {
writable: true,

View file

@ -132,7 +132,7 @@ export default defineConfig(async ({ mode, command }) => {
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/tests/setup.ts",
setupFiles: "./src/tests/setup.tsx",
},
server: {
proxy: {