I am trying to set the query retries to false for my tests using Jest / RTL, I was reading https://tkdodo.eu/blog/testing-react-query
It says specifying the options to:
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
},
},
})
await render(<QueryClientProvider client={queryClient}><DataProvider><App /></DataProvider></QueryClientProvider>)
expect(await screen.findByText(/Error fetching data/i)).toBeInTheDocument();
But this does not work as it still retries the query, however if I set the actual query to retry false, then the test passes, however I do not want to turn off retries to the actual query, just for the test only.
Any Idea's, what could be going wrong? I would have thought as per the article that setting it in the test would effect the component tree?
I have reset the handler also for MSW, to get a 500 error response.