Skip to content

Commit

Permalink
docs: make hook return all necessary variables (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
asdofindia authored Dec 11, 2020
1 parent 7786867 commit 8aeb209
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/src/pages/docs/guides/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ Given the following custom hook:

```
function useFetchData() {
const { data } = useQuery('fetchData', () => request('/api/data'));
return data;
return useQuery('fetchData', () => request('/api/data'));
}
```

Expand Down Expand Up @@ -85,7 +84,7 @@ await waitFor(() => {
expect(result.current).toEqual({answer: 42});
```

Here we are making use of `waitFor` and waiting until our Nock expectation indicates that it has been called. This way we know that our hook has finished and should have the correct data.
Here we are making use of `waitFor` and waiting until our the query status indicates that the request has succeeded. This way we know that our hook has finished and should have the correct data.

## Testing Load More / Infinite Scroll

Expand Down

1 comment on commit 8aeb209

@vercel
Copy link

@vercel vercel bot commented on 8aeb209 Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.