Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import { render } from '@solidjs/testing-library'
3import { QueryClient, QueryClientProvider } from '@tanstack/solid-query'
4import SolidQueryDevtools from '../devtools'
5β
6describe('SolidQueryDevtools', () => {
7 it('should throw an error if no query client has been set', () => {
8 expect(() => render(() => <SolidQueryDevtools />)).toThrow(
9 'No QueryClient set, use QueryClientProvider to set one',
10 )
11 })
12β
13 it('should not throw an error if query client is provided via context', () => {
14 const queryClient = new QueryClient()
15β
16 expect(() =>
17 render(() => (
18 <QueryClientProvider client={queryClient}>
19 <SolidQueryDevtools />
20 </QueryClientProvider>
21 )),
22 ).not.toThrow()
23 })
24β
25 it('should not throw an error if query client is provided via props', () => {
26 const queryClient = new QueryClient()
27β
28 expect(() =>
29 render(() => <SolidQueryDevtools client={queryClient} />),
30 ).not.toThrow()
31 })
32})