Skip to content

test(query-core/hydration): assert the exact infinite query result with 'toEqual'#11045

Merged
sukvvon merged 1 commit into
mainfrom
test/hydration-toequal
Jul 11, 2026
Merged

test(query-core/hydration): assert the exact infinite query result with 'toEqual'#11045
sukvvon merged 1 commit into
mainfrom
test/hydration-toequal

Conversation

@sukvvon

@sukvvon sukvvon commented Jul 11, 2026

Copy link
Copy Markdown
Member

🎯 Changes

These infinite-query hydration tests only checked the shape of the result via several loose assertions (toHaveProperty, toHaveLength, Array.isArray), never the actual contents. Since the result type is exactly InfiniteData = { pages, pageParams } (no hidden/non-deterministic fields) and the queryFn returns deterministic values, these are collapsed into a single exact toEqual that also verifies the page contents (items, next/nextCursor) and pageParams values. This also removes an as any cast.

✅ Checklist

🚀 Release Impact

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

Summary by CodeRabbit

  • Tests
    • Strengthened hydration and refetch test assertions for infinite queries.
    • Added exact validation of page contents, ordering, and page parameters to improve regression coverage.

@nx-cloud

nx-cloud Bot commented Jul 11, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 33c8296

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 7m 54s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-11 02:58:26 UTC

@sukvvon sukvvon self-assigned this Jul 11, 2026
@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: 40931a82-8508-4bc3-9309-f8e1b9f0c1f3

📥 Commits

Reviewing files that changed from the base of the PR and between dea3698 and 33c8296.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/hydration.test.tsx

📝 Walkthrough

Walkthrough

Changes

Hydration Assertion Updates

Layer / File(s) Summary
Strict infinite-query expectations
packages/query-core/src/__tests__/hydration.test.tsx
Hydration and post-hydration refetch tests now use exact deep equality for infinite-query pages, items, cursors, ordering, and page parameters.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the test-only change and the shift to exact toEqual assertions for infinite-query hydration results.
Description check ✅ Passed The description follows the template and covers changes, checklist, and release impact with concrete details.
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/hydration-toequal

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

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 33c8296

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

@sukvvon sukvvon merged commit 969772d into main Jul 11, 2026
9 checks passed
@sukvvon sukvvon deleted the test/hydration-toequal branch July 11, 2026 04:32
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