Mock API with MSW

This commit is contained in:
Alex Gleason
2022-03-16 13:55:18 -05:00
parent 6a6a7b614d
commit d07d9b5bed
9 changed files with 407 additions and 53 deletions

View File

@@ -3,12 +3,14 @@
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { __clear as clearApiMocks } from 'soapbox/api';
import { server } from 'soapbox/msw';
// Enzyme
const adapter = new Adapter();
configure({ adapter });
// API mocking
jest.mock('soapbox/api');
afterEach(() => clearApiMocks());
// Setup MSW
// https://mswjs.io/docs/api/setup-server
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());