react Qurey Jest Test simulé QueryClientProvider
const queryClient = new QueryClient();
2 const wrapper = ({ children }) => (
3 <QueryClientProvider client={queryClient}>
4 {children}
5 </QueryClientProvider>
6 );
7
8 const { result, waitFor } = renderHook(() => useCustomHook(), { wrapper });
9
10 await waitFor(() => result.current.isSuccess);
11
12 expect(result.current.data).toEqual("Hello");
Courageous Cockroach