-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (31 loc) · 944 Bytes
/
Copy pathjest.setup.js
File metadata and controls
37 lines (31 loc) · 944 Bytes
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
import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { TestProvider } from '@/tests/TestProvider';
import { render } from '@testing-library/react';
import 'whatwg-fetch';
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
global.customRender = (ui, options) =>
render(ui, { wrapper: TestProvider, ...options });
// Mock IntersectionObserver
global.IntersectionObserver = class {
constructor() {}
observe() {}
unobserve() {}
disconnect() {}
};
global.queryClient = new QueryClient();
global.QueryClientProvider = QueryClientProvider;
global.Response = Response;
global.Request = Request;
global.Headers = Headers;
global.BroadcastChannel = class {
constructor() {
this.name = 'mock-broadcast-channel';
}
postMessage() {}
close() {}
addEventListener() {}
removeEventListener() {}
};