-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: mock api endpoints and let unit tests use those endpoints
- Loading branch information
1 parent
1b658bb
commit 6082fb3
Showing
18 changed files
with
1,036 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { server } from "@/api/mocks/server"; | ||
|
||
beforeAll(() => { | ||
// Establish API mocking before all tests. | ||
server.listen(); | ||
}); | ||
|
||
afterEach(() => { | ||
// Reset any MSW request handlers that we may add during the tests, | ||
// so they don't affect other tests. | ||
server.resetHandlers(); | ||
|
||
jest.clearAllMocks(); | ||
}); | ||
|
||
afterAll(() => { | ||
// Clean up after the tests are finished. | ||
server.close(); | ||
}); |
Oops, something went wrong.