Jest: Add mock service worker server commands to jest.setup.js

This commit makes the `msw` server globally available to all test files.
Given that the majority of our test files will ultimately make calls to
APIs using RTK Query (calls are made in both the table and the wizard),
making these globally available in jest.setup.js is reasonable.
This commit is contained in:
lucasgarfield 2023-02-22 09:56:22 +01:00 committed by Lucas Garfield
parent a0ed7cd37e
commit 8adfd793d6

View file

@ -1 +1,6 @@
import 'whatwg-fetch';
import { server } from './src/test/mocks/server';
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());