Skip to content

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

Merged
sukvvon merged 2 commits into
mainfrom
test/angular-query-replace-async-await-sleep-with-then-chaining
Apr 6, 2026
Merged

test(angular-query-experimental): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn'#10404
sukvvon merged 2 commits into
mainfrom
test/angular-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 inject-query.test.ts and pending-tasks.test.ts

✅ 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

Release Notes

  • Tests
    • Updated internal test implementations to use promise chaining syntax, maintaining equivalent test behavior and coverage.

Note: This release contains no user-facing changes or new features.

…leep().then()' in test 'queryFn' and 'mutationFn'
@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: 3c71228d-fbfc-4f40-b517-902d3a652711

📥 Commits

Reviewing files that changed from the base of the PR and between eac62b8 and be7d4a8.

📒 Files selected for processing (2)
  • packages/angular-query-experimental/src/__tests__/inject-query.test.ts
  • packages/angular-query-experimental/src/__tests__/pending-tasks.test.ts

📝 Walkthrough

Walkthrough

Updated test-only queryFn and mutationFn implementations in Angular Query experimental package to use promise chaining (sleep(...).then(...)) instead of async/await syntax. The refactoring maintains promise behavior while simplifying function declarations across multiple test cases without altering assertions or logic.

Changes

Cohort / File(s)Summary
Test Promise Refactoring
packages/angular-query-experimental/src/__tests__/inject-query.test.ts, packages/angular-query-experimental/src/__tests__/pending-tasks.test.ts
Converted async/await queryFn/mutationFn implementations to promise chaining pattern. Changed from async functions with await sleep(50); return value to non-async functions returning sleep(50).then(() => value). Affects component-level queries, mutations, and concurrent test cases.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through test files with glee,
Async/await chains now flow like promise.then() spree,
No logic bent, just syntax set free,
Promise trees bloom without the await decree!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and specifically describes the main change: replacing async/await sleep patterns with promise chaining in test functions across two test files.
Description check✅ PassedThe description covers all required template sections with specific details about changes, completed the appropriate checklist items, and correctly identified this as a dev-only change requiring no changeset.
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/angular-query-replace-async-await-sleep-with-then-chaining

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

@sukvvonsukvvon self-assigned this Apr 6, 2026
@nx-cloud

nx-cloudBot commented Apr 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit be7d4a8

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

☁️ Nx Cloud last updated this comment at 2026-04-06 10:19:32 UTC

@github-actions

github-actionsBot commented Apr 6, 2026

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@10404

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: be7d4a8

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

@sukvvon
sukvvon merged commit 1493433 into mainApr 6, 2026
8 checks passed
@sukvvon
sukvvon deleted the test/angular-query-replace-async-await-sleep-with-then-chaining branch April 6, 2026 10:54
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