2021-02-09 20:35:33 +01:00
|
|
|
import 'regenerator-runtime/runtime';
|
|
|
|
import '@testing-library/jest-dom/extend-expect';
|
|
|
|
|
|
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
|
|
writable: true,
|
|
|
|
value: (query) => ({
|
|
|
|
matches: false,
|
|
|
|
media: query,
|
|
|
|
onchange: null,
|
|
|
|
addEventListener: jest.fn(),
|
|
|
|
removeEventListener: jest.fn(),
|
|
|
|
dispatchEvent: jest.fn(),
|
|
|
|
}),
|
|
|
|
});
|
2021-02-11 16:13:21 +01:00
|
|
|
|
|
|
|
window.fetch = () => Promise.resolve();
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
jest.spyOn(window, 'fetch').mockImplementation(async (url, opts = {}) => {
|
|
|
|
throw new Error(`Unexpected fetch to ${url}, ${JSON.stringify(opts)}`);
|
|
|
|
});
|
|
|
|
});
|
2021-02-14 05:37:22 +01:00
|
|
|
|
|
|
|
jest.mock('../src/env');
|