File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11import React from "react"
22import { render , RenderOptions } from "@testing-library/react"
3+ import { QueryClient , QueryClientProvider } from "@tanstack/react-query"
34
45import { TooltipProvider } from "@src/components/ui/tooltip"
56import { STANDARD_TOOLTIP_DELAY } from "@src/components/ui/standard-tooltip"
@@ -9,7 +10,20 @@ interface AllTheProvidersProps {
910}
1011
1112const AllTheProviders = ( { children } : AllTheProvidersProps ) => {
12- return < TooltipProvider delayDuration = { STANDARD_TOOLTIP_DELAY } > { children } </ TooltipProvider >
13+ // Create a new QueryClient for each test to avoid state leakage
14+ const queryClient = new QueryClient ( {
15+ defaultOptions : {
16+ queries : {
17+ retry : false , // Disable retries in tests
18+ } ,
19+ } ,
20+ } )
21+
22+ return (
23+ < QueryClientProvider client = { queryClient } >
24+ < TooltipProvider delayDuration = { STANDARD_TOOLTIP_DELAY } > { children } </ TooltipProvider >
25+ </ QueryClientProvider >
26+ )
1327}
1428
1529const customRender = ( ui : React . ReactElement , options ?: Omit < RenderOptions , "wrapper" > ) =>
You can’t perform that action at this time.
0 commit comments