From 1814f56ea1d396a1ed88c7221fecf7099e80e7f9 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:30:54 +1000 Subject: [PATCH] chore(svelte-query): Tweak provider tests (#7794) --- .github/workflows/pr.yml | 2 ++ .../tests/AwaitOnSuccess/AwaitOnSuccess.svelte | 2 +- .../tests/FreshData/FreshData.svelte | 4 ++-- .../tests/InitialData/InitialData.svelte | 2 +- .../tests/OnSuccess/OnSuccess.svelte | 2 +- .../tests/PersistQueryClientProvider.test.ts | 6 +++--- .../tests/RemoveCache/RemoveCache.svelte | 2 +- .../tests/RestoreCache/RestoreCache.svelte | 2 +- .../tests/UseQueries/UseQueries.svelte | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d321972b86..734e4a0168 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,6 +2,8 @@ name: pr on: pull_request: + push: + branches: ['svelte-5-adapter'] concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} diff --git a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte index 06230edd15..7316ce609c 100644 --- a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte +++ b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte @@ -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' }, diff --git a/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte b/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte index 387a34ac0e..48670b32d2 100644 --- a/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte +++ b/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte @@ -11,7 +11,7 @@ queryKey: ['test'], queryFn: async () => { fetched.set(true) - await sleep(10) + await sleep(5) return 'fetched' }, @@ -21,5 +21,5 @@ $: states.update((prev) => [...prev, $query]) -
data: {$query.data ?? 'null'}
+
data: {$query.data ?? 'undefined'}
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte b/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte index 2095508dd1..6046f552e3 100644 --- a/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte +++ b/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte @@ -9,7 +9,7 @@ const query = createQuery({ queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'fetched' }, diff --git a/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte b/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte index 2ae8e7d970..c890014886 100644 --- a/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte +++ b/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte @@ -5,7 +5,7 @@ const query = createQuery({ queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'fetched' }, }) diff --git a/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.test.ts b/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.test.ts index 0188d210e1..1366fe8541 100644 --- a/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.test.ts +++ b/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.test.ts @@ -26,7 +26,7 @@ const createMockPersister = (): Persister => { storedState = persistClient }, async restoreClient() { - await sleep(10) + await sleep(5) return storedState }, removeClient() { @@ -46,7 +46,7 @@ const createMockErrorPersister = ( // noop }, async restoreClient() { - await sleep(10) + await sleep(5) throw error }, removeClient, @@ -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) diff --git a/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte b/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte index 2ae8e7d970..c890014886 100644 --- a/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte +++ b/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte @@ -5,7 +5,7 @@ const query = createQuery({ queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'fetched' }, }) diff --git a/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte b/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte index 7bae863702..2e2af65a58 100644 --- a/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte +++ b/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte @@ -9,7 +9,7 @@ const query = createQuery({ queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'fetched' }, }) diff --git a/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte b/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte index 8cf6647442..dbf88e6fb7 100644 --- a/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte +++ b/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte @@ -11,7 +11,7 @@ { queryKey: ['test'], queryFn: async (): Promise => { - await sleep(10) + await sleep(5) return 'fetched' }, },