Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/solid-query/src/__tests__/useQueries.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
it,
vi,
} from 'vitest'
import { fireEvent } from '@solidjs/testing-library'
import { fireEvent, render } from '@solidjs/testing-library'
import * as QueryCore from '@tanstack/query-core'
import { createRenderEffect, createSignal } from 'solid-js'
import { queryKey, sleep } from '@tanstack/query-test-utils'
Expand Down Expand Up @@ -724,6 +724,32 @@ describe('useQueries', () => {
QueriesObserverSpy.mockRestore()
})

it('should use provided custom queryClient', async () => {
const key = queryKey()
const queryFn = () => sleep(10).then(() => 'custom client')

function Page() {
const queries = useQueries(
() => ({
queries: [
{
queryKey: key,
queryFn,
},
],
}),
() => queryClient,
)

return <div>data: {queries[0].data}</div>
}

const rendered = render(() => <Page />)

await vi.advanceTimersByTimeAsync(10)
expect(rendered.getByText('data: custom client')).toBeInTheDocument()
})

it('should not fetch for the duration of the restoring period when isRestoring is true', async () => {
const key1 = queryKey()
const key2 = queryKey()
Expand Down
Loading