Skip to content

test(solid-query-persist-client/PersistQueryClientProvider): replace 'toMatchObject' with 'toEqual'#11044

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

test(solid-query-persist-client/PersistQueryClientProvider): replace 'toMatchObject' with 'toEqual'#11044
sukvvon merged 1 commit into
mainfrom
test/solid-persist-toequal

Conversation

@sukvvon

@sukvvon sukvvon commented Jul 11, 2026

Copy link
Copy Markdown
Member

🎯 Changes

The states array in these tests is populated with hand-built literals of exactly three fields (status, fetchStatus, data) — its type is Array<{ status; fetchStatus; data }>. Since every field is asserted and no extra fields exist, the partial toMatchObject matcher is tightened to the exact toEqual, which additionally catches any unexpected extra key on the observed state.

Note: the sibling react-query persist test pushes the raw UseQueryResult (dozens of fields), so toMatchObject is correct there and is left unchanged — only this solid test builds a 3-field literal.

✅ Checklist

🚀 Release Impact

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

Summary by CodeRabbit

  • Tests
    • Strengthened test assertions for persisted query state transitions.
    • Added explicit checks for query status, fetch status, and returned data across captured states.

@nx-cloud

nx-cloud Bot commented Jul 11, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit c57138a

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

☁️ Nx Cloud last updated this comment at 2026-07-11 02:54:37 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.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated five PersistQueryClientProvider test scenarios to use exact object equality for captured query states, explicitly checking status, fetchStatus, and data.

Changes

Persisted query state tests

Layer / File(s) Summary
Strict query state assertions
packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
Restoration, idle-state, initial-data, fresh-data, and multi-client persistence tests now use exact toEqual assertions for captured states.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main test assertion change in the Solid provider tests.
Description check ✅ Passed The description follows the required template and includes the change summary, checklist, and release impact section.
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/solid-persist-toequal

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

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: c57138a

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx`:
- Around line 117-129: Replace `toEqual` with `toStrictEqual` in all five
pending-state shape assertions in `PersistQueryClientProvider.test.tsx`,
ensuring each check verifies that the `data: undefined` property is explicitly
present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: abaa75d5-4b9e-4e66-b6b1-d30f3f91a0f6

📥 Commits

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

📒 Files selected for processing (1)
  • packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx

Comment on lines +117 to +129
expect(states[0]).toEqual({
status: 'pending',
fetchStatus: 'idle',
data: undefined,
})

expect(states[1]).toMatchObject({
expect(states[1]).toEqual({
status: 'success',
fetchStatus: 'fetching',
data: 'hydrated',
})

expect(states[2]).toMatchObject({
expect(states[2]).toEqual({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

fd -a -t f '^(package\.json|pnpm-lock\.yaml|yarn\.lock|package-lock\.json|bun\.lock)$' \
  | xargs -r rg -n '"vitest"'

rg -n 'expect\(states\[[0-9]+\]\)\.to(Equal|StrictEqual)\(' \
  packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx

Repository: TanStack/query

Length of output: 2631


🏁 Script executed:

#!/bin/bash
set -eu

sed -n '90,145p' packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
printf '\n----\n'
sed -n '180,225p' packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
printf '\n----\n'
sed -n '270,310p' packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
printf '\n----\n'
sed -n '360,390p' packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
printf '\n----\n'
sed -n '575,605p' packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx

Repository: TanStack/query

Length of output: 4946


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
p = Path('packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx')
text = p.read_text()
for i, line in enumerate(text.splitlines(), 1):
    if 'toEqual({' in line or 'toStrictEqual({' in line or 'data: undefined' in line:
        if 100 <= i <= 610:
            print(f'{i}: {line}')
PY

Repository: TanStack/query

Length of output: 782


Use toStrictEqual for the pending-state shape checks. toEqual treats a missing data key the same as data: undefined, so these assertions can miss a regression where the pending state stops including the property. Replace it in all five blocks.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx`
around lines 117 - 129, Replace `toEqual` with `toStrictEqual` in all five
pending-state shape assertions in `PersistQueryClientProvider.test.tsx`,
ensuring each check verifies that the `data: undefined` property is explicitly
present.

@sukvvon sukvvon merged commit bd07339 into main Jul 11, 2026
9 checks passed
@sukvvon sukvvon deleted the test/solid-persist-toequal branch July 11, 2026 04:29
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