Skip to content

Commit

Permalink
Update MockFunctions.md (jestjs#6386)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksugr authored and SimenB committed Jun 4, 2018
1 parent 3a1afce commit 241588a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default Users;

Now, in order to test this method without actually hitting the API (and thus creating slow and fragile tests), we can use the `jest.mock(...)` function to automatically mock the axios module.

Once we mock the module we can provide a `mockReturnValue` for `.get` that returns the data we want our test to assert against. In effect, we are saying that we want axios.get('/users.json') to return a fake response.
Once we mock the module we can provide a `mockResolvedValue` for `.get` that returns the data we want our test to assert against. In effect, we are saying that we want axios.get('/users.json') to return a fake response.

```js
// users.test.js
Expand Down

0 comments on commit 241588a

Please sign in to comment.