blakeblackshear.frigate/web/config/setupTests.js

30 lines
710 B
JavaScript
Raw Normal View History

2021-02-09 20:35:33 +01:00
import 'regenerator-runtime/runtime';
import '@testing-library/jest-dom/extend-expect';
2022-03-06 05:16:31 +01:00
import { server } from './server.js';
2021-02-09 20:35:33 +01:00
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
2021-02-14 05:37:22 +01:00
jest.mock('../src/env');
2022-03-06 05:16:31 +01:00
// Establish API mocking before all tests.
beforeAll(() => server.listen());
// Reset any request handlers that we may add during the tests,
// so they don't affect other tests.
afterEach(() => {
server.resetHandlers();
});
// Clean up after the tests are finished.
afterAll(() => server.close());