From 8aeb209c3b9c84382a88059afbc398be93a69b33 Mon Sep 17 00:00:00 2001 From: Akshay S Dinesh Date: Fri, 11 Dec 2020 15:37:54 +0530 Subject: [PATCH] docs: make hook return all necessary variables (#1391) --- docs/src/pages/docs/guides/testing.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/src/pages/docs/guides/testing.md b/docs/src/pages/docs/guides/testing.md index e6d6ef26f7..d6cb414b57 100644 --- a/docs/src/pages/docs/guides/testing.md +++ b/docs/src/pages/docs/guides/testing.md @@ -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')); } ``` @@ -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