Skip to content

Commit 6db3d9d

Browse files
author
Matthieu Gicquel
committed
more README updates
1 parent 5e00423 commit 6db3d9d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<p align="center"><i>Simple http mocking, with good developer experience</i></p>
44

5-
- [Use it tests](#usage-in-tests-🧪) - mock API calls, with [good practices enforced](#whats-different-from-other-http-mocking-libraries)
6-
- [Use it in the browser or React Native apps](#usage-in-an-app-📱🖥️) - during development, or for a "demo mode"
5+
- [Use it tests 🧪](#usage-in-tests) - mock API calls, with [good practices enforced](#whats-different-from-other-http-mocking-libraries)
6+
- [Use it in the browser 🖥️ or React Native apps 📱](#usage-in-an-app) - during development, or for a "demo mode"
77

88
---
99

@@ -14,11 +14,11 @@ yarn add --dev @matthieug/shm
1414
| Platform | Status | Notes |
1515
| ------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
1616
| `node` / `jest` || node>=18 required |
17-
| `node` / `jest` / `jsdom` | 🧑‍💻 | [Polyfills required](https://mswjs.io/docs/migrations/1.x-to-2.x#requestresponsetextencoder-is-not-defined-jest) |
17+
| `node` / `jest` / `jsdom` | | [Polyfills required](https://mswjs.io/docs/migrations/1.x-to-2.x#requestresponsetextencoder-is-not-defined-jest) |
1818
| `node` / `vitest` || node>=18 required |
1919
| `bun` with `bun test` | ⚠️ | test won't fail with `afterEach(expectRequestsToMatchHandlers)` |
2020
| `expo` || Install [react-native-url-polyfill](https://github.com/charpeni/react-native-url-polyfill) if using SDK < 50 |
21-
| `react-native` | 🧑‍💻 | Install [react-native-url-polyfill](https://github.com/charpeni/react-native-url-polyfill) |
21+
| `react-native` | | Install [react-native-url-polyfill](https://github.com/charpeni/react-native-url-polyfill) |
2222
| browser || |
2323

2424
## Basic usage
@@ -55,7 +55,12 @@ mockServer.get<BodyType>("item/:id", {
5555

5656
Have a look at the [type definitions](./src/types.ts) for more details.
5757

58-
## Usage in tests 🧪
58+
**Important notes:**
59+
60+
- Handlers will by default only respond to **ONE** matching request. After that, they will be "consumed"
61+
- Handlers are used in a _first_in_first_out_ order
62+
63+
## Usage in tests
5964

6065
### Setup
6166

@@ -135,7 +140,7 @@ We want to promote a certain way to define and use api mocks in tests, and provi
135140
- Check that your code is sending the correct request through **assertions**, instead of by coincidentally definining the right handler
136141
- Prefer specifying the necessary mocks for each test, so that you **know at a glance what APIs your feature/component needs**
137142

138-
## Usage in an app 📱🖥️
143+
## Usage in an app
139144

140145
```ts
141146
import { installInterceptor, createMockServer, uninstallInterceptor } from "@matthieug/shm";

0 commit comments

Comments
 (0)