diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-03-24 21:43:44 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-03-24 21:43:44 +0100 |
| commit | 73131da73da41c64135ed4236bd84ddba6e0c149 (patch) | |
| tree | 6849f0d2884b103e432980330f866b995b7f5947 /__tests__/jest/__mocks__/matchMedia.mock.js | |
| parent | 6b5c861eea12c67c4440d9e086513bd8b196c150 (diff) | |
| parent | 2de1ca173ee3d8e5886a1b3fdc4afbe102fad22f (diff) | |
build: configure Jest
Since Next.js v12, we can use next/js package with some
preconfigured Jest options.
Diffstat (limited to '__tests__/jest/__mocks__/matchMedia.mock.js')
| -rw-r--r-- | __tests__/jest/__mocks__/matchMedia.mock.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/__tests__/jest/__mocks__/matchMedia.mock.js b/__tests__/jest/__mocks__/matchMedia.mock.js new file mode 100644 index 0000000..a983ad3 --- /dev/null +++ b/__tests__/jest/__mocks__/matchMedia.mock.js @@ -0,0 +1,15 @@ +Object.defineProperty(window, 'matchMedia', { + writable: true, + value: jest.fn().mockImplementation((query) => ({ + matches: false, + media: query, + onchange: null, + addListener: jest.fn(), // deprecated + removeListener: jest.fn(), // deprecated + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + dispatchEvent: jest.fn(), + })), +}); + +export {}; |
