We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 023451a + 0f0b5bd commit 93f47e5Copy full SHA for 93f47e5
jest.setup.js
@@ -10,6 +10,21 @@ if (!global.TextDecoder) {
10
global.TextDecoder = TextDecoder;
11
}
12
13
+// window.matchMedia doesn't exist in test environment
14
+Object.defineProperty(window, 'matchMedia', {
15
+ writable: true,
16
+ value: jest.fn().mockImplementation(query => ({
17
+ matches: false,
18
+ media: query,
19
+ onchange: null,
20
+ addListener: jest.fn(), // deprecated
21
+ removeListener: jest.fn(), // deprecated
22
+ addEventListener: jest.fn(),
23
+ removeEventListener: jest.fn(),
24
+ dispatchEvent: jest.fn(),
25
+ })),
26
+});
27
+
28
global.React = React;
29
30
const savedLocation = window.location;
0 commit comments