Skip to content

Commit 7e8f1c9

Browse files
author
lsimone
committed
readme example fixed
1 parent 756ff58 commit 7e8f1c9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,13 @@ The promise should resolve with an object containing body and init props
8181
i.e:
8282

8383
```
84-
fetch.mockResponse(new Promise((resolve, reject) => {
85-
return callMyApi().then(res => ({body: res}))
86-
}))
84+
fetch.mockResponse(() => callMyApi().then(res => ({body: res}))
8785
```
8886

8987
The same goes for rejects:
9088

9189
```
92-
fetch.mockReject(new Promise((resolve, reject) => {
93-
return doMyAsyncJob().then(res => res.errorToRaise)
94-
}))
90+
fetch.mockReject(() => doMyAsyncJob().then(res => res.errorToRaise))
9591
```
9692

9793
### Mock utilities

0 commit comments

Comments
 (0)