Skip to content

test(query-core/queryObserver): unify all test descriptions to start with 'should'#10897

Merged
sukvvon merged 1 commit into
mainfrom
test/query-core-query-observer-unify-test-descriptions-to-should
Jun 7, 2026
Merged

test(query-core/queryObserver): unify all test descriptions to start with 'should'#10897
sukvvon merged 1 commit into
mainfrom
test/query-core-query-observer-unify-test-descriptions-to-should

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Jun 7, 2026

🎯 Changes

Unify all test descriptions in queryObserver.test.tsx to start with should, so every it follows the same convention.

  • Method-name prefixes are rewritten as should ..., keeping the method name where it identifies the behavior (from getCurrentQuery, when setOptions is called, via fetchOptimistic).
  • shouldFetchOnWindowFocus should return true/false ... is rewritten as should return true/false from shouldFetchOnWindowFocus ..., removing the duplicated should while still describing exactly what is asserted (the method return value).
  • uses placeholderData ... becomes should use placeholderData ....

✅ 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
    • Clarified and improved several human-readable test descriptions to make intent and expected behaviors easier to understand (covering placeholder data handling, current-query reporting, cache listener notifications on option changes, observer staleness when disabled, window-focus refetch behavior, and optimistic-result scenarios). No functional behavior or assertions were changed.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 7, 2026

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: fceb4128-720f-40e1-b3a0-9946addfcd6d

📥 Commits

Reviewing files that changed from the base of the PR and between 4de4710 and c132b0f.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/queryObserver.test.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/query-core/src/tests/queryObserver.test.tsx

📝 Walkthrough

Walkthrough

Test case descriptions in queryObserver.test.tsx are updated to use consistent "should" phrasing across several tests; no test logic, assertions, or exported APIs changed.

Changes

Test description improvements

Layer / File(s) Summary
QueryObserver test case descriptions
packages/query-core/src/__tests__/queryObserver.test.tsx
Seven test case names are renamed to use consistent "should" phrasing: placeholderData pending, getCurrentQuery return, setOptions notifications, disabled observer staleness, window-focus refetch behavior (enabled and disabled), and fetchOptimistic optimistic results. Test logic and assertions remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • TanStack/query#10889: Splits and renames the shouldFetchOnWindowFocus window-focus refetch test cases by refetchOnWindowFocus value, which directly aligns with the test description updates in this PR.

Poem

🐰 With a nib and a hop I rewrite a line,

I tuck old wording where new phrases shine,
Tests hum the same tune, unchanged at their core,
Just kinder to read than the names were before,
A tidy small change — then I bound out the door.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: unifying test descriptions in queryObserver.test.tsx to follow a 'should' convention.
Description check ✅ Passed The description covers all required template sections with concrete details about what was changed and why, and includes a completed checklist indicating the contributor tested locally and marked it as dev-only.
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.

✏️ 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/query-core-query-observer-unify-test-descriptions-to-should

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

@sukvvon sukvvon self-assigned this Jun 7, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 7, 2026

View your CI Pipeline Execution ↗ for commit 4de4710

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

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-07 03:57:48 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

🚀 Changeset Version Preview

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 7, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: c132b0f

@sukvvon sukvvon force-pushed the test/query-core-query-observer-unify-test-descriptions-to-should branch from 4de4710 to c132b0f Compare June 7, 2026 03:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

size-limit report 📦

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

@sukvvon sukvvon merged commit 1d12194 into main Jun 7, 2026
11 of 12 checks passed
@sukvvon sukvvon deleted the test/query-core-query-observer-unify-test-descriptions-to-should branch June 7, 2026 03:59
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