-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.ts
47 lines (41 loc) · 1.06 KB
/
setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { cleanup } from "@testing-library/react";
import { afterEach } from "vitest";
import * as matchers from "@testing-library/jest-dom/matchers";
import { expect } from "vitest";
expect.extend(matchers);
// mock window matchMedia
// Object.defineProperty(window, "matchMedia", {
// writable: true,
// value: vi.fn().mockImplementation((query) => ({
// matches: false,
// media: query,
// onchange: null,
// addListener: vi.fn(), // deprecated
// removeListener: vi.fn(), // deprecated
// addEventListener: vi.fn(),
// removeEventListener: vi.fn(),
// dispatchEvent: vi.fn(),
// })),
// });
afterEach(() => {
cleanup();
});
// beforeEach(() => {
// vi.mock('next/router', () => ({
// useRouter() {
// return {
// route: '/',
// pathname: '',
// query: '',
// asPath: '',
// locale: 'en',
// };
// },
// }));
// });
beforeEach(() => {
vi.mock("next/font/google", () => ({
Alexandria: () => ({ className: "" }),
Rammetto_One: () => ({ className: "" }),
}));
});