Skip to content

Instantly share code, notes, and snippets.

@marta-pinkowska
Created September 26, 2022 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marta-pinkowska/81673bda4122af5fe207230af46dd2ad to your computer and use it in GitHub Desktop.
Save marta-pinkowska/81673bda4122af5fe207230af46dd2ad to your computer and use it in GitHub Desktop.
// src/setupTests.js
import { server } from './mocks/server.js'
// 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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment