Skip to content

Commit

Permalink
chore(svelte-query): Tweak provider tests (TanStack#7794)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins authored Jul 26, 2024
1 parent 81e1f2c commit 1814f56
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: pr

on:
pull_request:
push:
branches: ['svelte-5-adapter']

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
queryKey: ['test'],
queryFn: async () => {
states.update((s) => [...s, 'fetching'])
await sleep(10)
await sleep(5)
states.update((s) => [...s, 'fetched'])
return 'fetched'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
queryKey: ['test'],
queryFn: async () => {
fetched.set(true)
await sleep(10)
await sleep(5)
return 'fetched'
},
Expand All @@ -21,5 +21,5 @@
$: states.update((prev) => [...prev, $query])
</script>

<div>data: {$query.data ?? 'null'}</div>
<div>data: {$query.data ?? 'undefined'}</div>
<div>fetchStatus: {$query.fetchStatus}</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const query = createQuery({
queryKey: ['test'],
queryFn: async () => {
await sleep(10)
await sleep(5)
return 'fetched'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const query = createQuery({
queryKey: ['test'],
queryFn: async () => {
await sleep(10)
await sleep(5)
return 'fetched'
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const createMockPersister = (): Persister => {
storedState = persistClient
},
async restoreClient() {
await sleep(10)
await sleep(5)
return storedState
},
removeClient() {
Expand All @@ -46,7 +46,7 @@ const createMockErrorPersister = (
// noop
},
async restoreClient() {
await sleep(10)
await sleep(5)
throw error
},
removeClient,
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('PersistQueryClientProvider', () => {
},
})

await waitFor(() => rendered.getByText('data: null'))
await waitFor(() => rendered.getByText('data: undefined'))
await waitFor(() => rendered.getByText('data: hydrated'))

const states = get(statesStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const query = createQuery({
queryKey: ['test'],
queryFn: async () => {
await sleep(10)
await sleep(5)
return 'fetched'
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const query = createQuery({
queryKey: ['test'],
queryFn: async () => {
await sleep(10)
await sleep(5)
return 'fetched'
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
queryKey: ['test'],
queryFn: async (): Promise<string> => {
await sleep(10)
await sleep(5)
return 'fetched'
},
},
Expand Down

0 comments on commit 1814f56

Please sign in to comment.