Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
afterEach(async () => {
queryCache.cancelQueries()
queryCache.clear()
// waitFor is important here. If there are queries that are being fetched at
// the end of the test and we continue on to the next test before waiting for
// them to finalize, the tests can impact each other in strange ways.
await waitFor(() => expect(queryCache.isFetching).toBe(0))
await flushPromises()
await act(async () => await null)
})