Skip to content

Commit 67e250b

Browse files
authored
test(query-devtools/Devtools): add test for rendering without a 'ThemeContext.Provider' (TanStack#10785)
1 parent 04fb3fb commit 67e250b

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

packages/query-devtools/src/__tests__/Devtools.test.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,4 +1516,36 @@ describe('Devtools', () => {
15161516
).not.toBeInTheDocument()
15171517
})
15181518
})
1519+
1520+
describe('default theme', () => {
1521+
it('should render without throwing when no "ThemeContext.Provider" wraps it', () => {
1522+
expect(() =>
1523+
render(() => {
1524+
const [localStore, setLocalStore] = createLocalStorage({
1525+
prefix: 'TanstackQueryDevtools',
1526+
})
1527+
return (
1528+
<QueryDevtoolsContext.Provider
1529+
value={{
1530+
client: queryClient,
1531+
queryFlavor: 'TanStack Query',
1532+
version: '5',
1533+
onlineManager,
1534+
}}
1535+
>
1536+
<PiPProvider
1537+
localStore={localStore}
1538+
setLocalStore={setLocalStore}
1539+
>
1540+
<Devtools
1541+
localStore={localStore}
1542+
setLocalStore={setLocalStore}
1543+
/>
1544+
</PiPProvider>
1545+
</QueryDevtoolsContext.Provider>
1546+
)
1547+
}),
1548+
).not.toThrow()
1549+
})
1550+
})
15191551
})

0 commit comments

Comments
 (0)