Open History to see the last commit
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})