Skip to content

Commit 8d2d229

Browse files
committed
fixed tests -- workaround for missing matchMedia function
1 parent d5b73a0 commit 8d2d229

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/setupTests.ts

+14
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
11
import '@testing-library/jest-dom';
2+
3+
Object.defineProperty(global, 'matchMedia', {
4+
writable: true,
5+
value: jest.fn().mockImplementation((query) => ({
6+
matches: false,
7+
media: query,
8+
onchange: null,
9+
addListener: jest.fn(), // deprecated
10+
removeListener: jest.fn(), // deprecated
11+
addEventListener: jest.fn(),
12+
removeEventListener: jest.fn(),
13+
dispatchEvent: jest.fn(),
14+
})),
15+
});

0 commit comments

Comments
 (0)