Skip to content

test({vue,angular}-query): pin the reactive refetch call with 'toHaveBeenNthCalledWith'#11051

Open
sukvvon wants to merge 1 commit into
mainfrom
test/reactive-refetch-nth
Open

test({vue,angular}-query): pin the reactive refetch call with 'toHaveBeenNthCalledWith'#11051
sukvvon wants to merge 1 commit into
mainfrom
test/reactive-refetch-nth

Conversation

@sukvvon

@sukvvon sukvvon commented Jul 11, 2026

Copy link
Copy Markdown
Member

🎯 Changes

In these tests, a reactive query key is changed and the query is refetched, so queryFn fires twice: first with the old key, then with the new key. The second call — the one that proves the reactive update reached the refetch — was asserted with order-agnostic toHaveBeenCalledWith, which would also pass if only the first call carried the new key.

Switching to toHaveBeenNthCalledWith(2, ...) pins the assertion to the second call, so it verifies the new key is used specifically on the refetch after the key changed.

  • vue-query/useQuerykeyRef changed then refetch()
  • angular-query-experimental/inject-query — key signal changed then re-run (the inline comment already states the intent is "the new queryKey")

✅ Checklist

🚀 Release Impact

  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Improved test accuracy for query refetching after reactive query key changes.
    • Tests now verify the arguments from the expected second invocation, ensuring updated query keys are handled correctly.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00ba5a51-738b-4512-8305-89c0768b6c46

📥 Commits

Reviewing files that changed from the base of the PR and between 72e90c8 and 65936f1.

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

📝 Walkthrough

Walkthrough

Changes

Query call assertions

Layer / File(s) Summary
Second-call verification
packages/angular-query-experimental/src/__tests__/inject-query.test.ts, packages/vue-query/src/__tests__/useQuery.test.ts
Tests now use toHaveBeenNthCalledWith(2, ...) to validate updated queryKey arguments on the second query or fetch invocation.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main test-only change: pinning reactive refetch assertions to the second call.
Description check ✅ Passed The description matches the template and includes changes, checklist, and release impact sections with the required intent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/reactive-refetch-nth

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

@nx-cloud

nx-cloud Bot commented Jul 11, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 65936f1

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 52s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-11 06:36:35 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.

@sukvvon sukvvon self-assigned this Jul 11, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11051

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 65936f1

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.13 KB (0%)
react minimal 9.08 KB (0%)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant