Skip to content

Commit 3bc0eb5

Browse files
committed
test(svelte-query/createQueries): move 'queryClient' inside 'IsRestoringExample' component
1 parent 1bfc560 commit 3bc0eb5

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

packages/svelte-query/tests/createQueries/IsRestoringExample.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import { createQueries } from '../../src/index.js'
55
66
let {
7-
queryClient,
87
queryFn1,
98
queryFn2,
109
}: {
11-
queryClient: QueryClient
1210
queryFn1: () => Promise<string>
1311
queryFn2: () => Promise<string>
1412
} = $props()
1513
14+
const queryClient = new QueryClient()
15+
1616
setIsRestoringContext({ current: true })
1717
1818
const result = createQueries(

packages/svelte-query/tests/createQueries/createQueries.svelte.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
22
import { render } from '@testing-library/svelte'
3-
import { QueryClient } from '@tanstack/query-core'
43
import { sleep } from '@tanstack/query-test-utils'
54
import IsRestoringExample from './IsRestoringExample.svelte'
65

@@ -14,12 +13,11 @@ describe('createQueries', () => {
1413
})
1514

1615
it('should not fetch for the duration of the restoring period when isRestoring is true', async () => {
17-
const queryClient = new QueryClient()
1816
const queryFn1 = vi.fn(() => sleep(10).then(() => 'data1'))
1917
const queryFn2 = vi.fn(() => sleep(10).then(() => 'data2'))
2018

2119
const rendered = render(IsRestoringExample, {
22-
props: { queryClient, queryFn1, queryFn2 },
20+
props: { queryFn1, queryFn2 },
2321
})
2422

2523
await vi.advanceTimersByTimeAsync(0)

0 commit comments

Comments
 (0)