diff --git a/src/__mocks__/matchMediaMock.js b/src/__mocks__/matchMediaMock.js new file mode 100644 index 0000000000..e5fada4652 --- /dev/null +++ b/src/__mocks__/matchMediaMock.js @@ -0,0 +1,10 @@ +window.matchMedia = 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(), +})) diff --git a/src/App.test.tsx b/src/__tests__/App.test.tsx similarity index 77% rename from src/App.test.tsx rename to src/__tests__/App.test.tsx index 4bf19359ea..692a59c330 100644 --- a/src/App.test.tsx +++ b/src/__tests__/App.test.tsx @@ -1,6 +1,7 @@ +import '../__mocks__/matchMediaMock' import React from 'react' import ReactDOM from 'react-dom' -import App from './App' +import App from '../App' it('renders without crashing', () => { const div = document.createElement('div')