mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-21 22:38:46 +00:00
chore: mock recharts
This commit is contained in:
parent
786d5600ed
commit
9320b26759
2 changed files with 13 additions and 2 deletions
|
@ -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,
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue