Skip to content

Commit

Permalink
feature: allow requests/responses to be reset (#17)
Browse files Browse the repository at this point in the history
* feature: allow requests/responses to be reset

* chore: update @babel/core

* chore: update readme

* fix: revert version change @babel/core

---------

Co-authored-by: Ron Derksen <[email protected]>
  • Loading branch information
ronderksen and Ron Derksen authored Nov 6, 2023
1 parent 3149e17 commit 78427cb
Show file tree
Hide file tree
Showing 4 changed files with 554 additions and 301 deletions.
17 changes: 17 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ To assert count of requests, use `getRequests()`:
expect(handler.getRequests()).toHaveLength(3);
```

### Reset request/response arrays between tests

If you want to clear the request/response arrays between tests, use the `reset` method:

```ts
describe('test', () => {
beforeEach(() => {
handler.reset()
});
})
```

### Manual Server

If you prefer to configure your server manually, you do not need to use `msw-expect/setup` in your Jest config.
Expand All @@ -139,3 +151,8 @@ import { setupServer } from "msw/node";

export const server = setupServer();
```

### Contributors

- [Anders D. Johnson](https:/github.com/AndersDJohnson)
- [Ron Derksen](https:/github.com/ronderksen)
Loading

0 comments on commit 78427cb

Please sign in to comment.