Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

QueryClientProvider.test.ts

20 lines607 Bytes

1import { describe, expect, test } from 'vitest'
2import { render, waitFor } from '@testing-library/svelte'
3import { QueryCache } from '@tanstack/query-core'
4import ParentComponent from './ParentComponent.svelte'
5​
6describe('QueryClientProvider', () => {
7 test('Sets a specific cache for all queries to use', async () => {
8 const queryCache = new QueryCache()
9​
10 const rendered = render(ParentComponent, {
11 props: {
12 queryCache: queryCache,
13 },
14 })
15​
16 await waitFor(() => rendered.getByText('Data: test'))
17​
18 expect(queryCache.find({ queryKey: ['hello'] })).toBeDefined()
19 })
20})