Skip to content

Commit 27a8b23

Browse files
flextremedevPascal Wegner
authored andcommitted
fix(docs): fix testing example
1 parent 813d70f commit 27a8b23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/src/pages/guides/testing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ const wrapper = ({ children }) => (
3636
</QueryClientProvider>
3737
);
3838
39-
const { result } = renderHook(() => useCustomHook(), { wrapper });
39+
const { result, waitFor } = renderHook(() => useCustomHook(), { wrapper });
4040
41-
expect(result.current).toEqual('Hello');
41+
await waitFor(() => result.current.isSuccess);
42+
43+
expect(result.current.data).toEqual("Hello");
4244
```
4345

4446
Note that we provide a custom wrapper that builds the `QueryClient` and `QueryClientProvider`. This helps to ensure that our test is completely isolated from any other tests.

0 commit comments

Comments
 (0)