Skip to content

test(svelte-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' - #10397

Merged
sukvvon merged 1 commit into
mainfrom
test/svelte-query-replace-async-await-sleep-with-then-chaining
Apr 6, 2026
Merged

test(svelte-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn'#10397
sukvvon merged 1 commit into
mainfrom
test/svelte-query-replace-async-await-sleep-with-then-chaining

Conversation

@sukvvon

@sukvvonsukvvon commented Apr 6, 2026

Copy link
Copy Markdown
Member

🎯 Changes

  • Replace async () => { await sleep(N); return value } with () => sleep(N).then(() => value) in test queryFn and mutationFn
  • Applied to createQuery.svelte.test.ts, useIsFetching/Query.svelte, and useIsMutating/Query.svelte

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Refactored test implementations to use promise chaining patterns while maintaining test behavior and assertions.

@coderabbitai

coderabbitaiBot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7c57dd3-b128-4b31-9ed7-524e1d692928

📥 Commits

Reviewing files that changed from the base of the PR and between e76d476 and a9c3c4b.

📒 Files selected for processing (3)
  • packages/svelte-query/tests/createQuery.svelte.test.ts
  • packages/svelte-query/tests/useIsFetching/Query.svelte
  • packages/svelte-query/tests/useIsMutating/Query.svelte

📝 Walkthrough

Walkthrough

This PR refactors async function implementations across three test files, replacing async/await syntax with promise chain patterns using .then(). All test logic, assertions, and timing calls remain unchanged. Net reduction of approximately 12 lines.

Changes

Cohort / File(s)Summary
Test Function Refactoring
packages/svelte-query/tests/createQuery.svelte.test.ts, packages/svelte-query/tests/useIsFetching/Query.svelte, packages/svelte-query/tests/useIsMutating/Query.svelte
Converted async/await function syntax to promise chains using .then() for queryFn and mutationFn implementations. No changes to test logic or control flow assertions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Async awaits hop away,
.then() chains come out to play,
Promise dances, clean and bright,
Tests are sparkling, all feels right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check nameStatusExplanation
Title check✅ PassedThe title accurately describes the main change: replacing async/await sleep patterns with promise-chain .then() in test functions across specified Svelte Query test files.
Description check✅ PassedThe description follows the template structure with clear 'Changes' section detailing the refactoring, completed checklist items, and proper release impact designation as dev-only.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/svelte-query-replace-async-await-sleep-with-then-chaining

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud

nx-cloudBot commented Apr 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a9c3c4b

CommandStatusDurationResult
nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded1m 57sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded<1sView ↗

☁️ Nx Cloud last updated this comment at 2026-04-06 01:35:44 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new

pkg-pr-newBot commented Apr 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10397

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10397

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10397

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10397

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10397

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10397

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10397

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10397

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10397

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10397

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10397

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10397

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10397

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10397

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10397

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10397

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10397

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10397

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10397

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10397

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10397

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10397

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10397

commit: a9c3c4b

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
react full11.98 KB (0%)
react minimal9.01 KB (0%)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@sukvvon