Skip to content

Comments

test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177

Open
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/svelte-query-infiniteQueryOptions-runtime
Open

test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/svelte-query-infiniteQueryOptions-runtime

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 24, 2026

🎯 Changes

Add a runtime test for infiniteQueryOptions identity function in @tanstack/svelte-query, matching the existing test in @tanstack/react-query.

✅ 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
    • Added a unit test to verify that infinite-query configuration objects (including keys, fetch functions, pagination params, and initial page) are passed through unchanged, ensuring the input object is preserved and not modified by the library.

@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

⚠️ No Changeset found

Latest commit: 58afb95

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b691a54 and 58afb95.

📒 Files selected for processing (1)
  • packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts

📝 Walkthrough

Walkthrough

A new unit test was added to the svelte-query package that asserts infiniteQueryOptions preserves the input object (queryKey, queryFn, getNextPageParam, initialPageParam) without modification via a strict equality check.

Changes

Cohort / File(s) Summary
Test Addition
packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts
Adds a Vitest unit test verifying infiniteQueryOptions returns the exact same input object (strict equality), ensuring no mutation or copying occurs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A test hops in, nose to the wire,
It sniffs an object, steady and sure,
"Stay the same," it whispers, no copy, no tire,
Identity held, unchanged and pure,
Hooray for a test that keeps things secure.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a runtime test for the infiniteQueryOptions identity function in svelte-query.
Description check ✅ Passed The description follows the required template with all sections completed, including changes explanation, completed checklist items, and appropriate release impact marking.
Docstring Coverage ✅ Passed No 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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 24, 2026

View your CI Pipeline Execution ↗ for commit 58afb95

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

☁️ Nx Cloud last updated this comment at 2026-02-24 02:47:37 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 58afb95

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In
`@packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts`:
- Line 14: The test currently asserts deep equality but intends to verify no
mutation/identity preservation: change the assertion in the test that calls
infiniteQueryOptions(object) so it asserts reference identity using toBe (you
can optionally keep toStrictEqual as an additional check), i.e., replace or
augment the existing expect(infiniteQueryOptions(object)).toStrictEqual(object)
with expect(...).toBe(object) while keeping the call to infiniteQueryOptions for
locating the check.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb7dca5 and b691a54.

📒 Files selected for processing (1)
  • packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts

initialPageParam: null,
}

expect(infiniteQueryOptions(object)).toStrictEqual(object)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Assert reference identity, not just deep equality.

toStrictEqual will still pass if infiniteQueryOptions returns a new object with the same shape. If the goal is identity/no mutation, use toBe (optionally keep toStrictEqual too).

✅ Proposed test tweak
-    expect(infiniteQueryOptions(object)).toStrictEqual(object)
+    expect(infiniteQueryOptions(object)).toBe(object)
+    expect(infiniteQueryOptions(object)).toStrictEqual(object)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(infiniteQueryOptions(object)).toStrictEqual(object)
expect(infiniteQueryOptions(object)).toBe(object)
expect(infiniteQueryOptions(object)).toStrictEqual(object)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts`
at line 14, The test currently asserts deep equality but intends to verify no
mutation/identity preservation: change the assertion in the test that calls
infiniteQueryOptions(object) so it asserts reference identity using toBe (you
can optionally keep toStrictEqual as an additional check), i.e., replace or
augment the existing expect(infiniteQueryOptions(object)).toStrictEqual(object)
with expect(...).toBe(object) while keeping the call to infiniteQueryOptions for
locating the check.

Sign up for free to 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