Skip to content

test(solid-query/queryOptions): add runtime test for identity function behavior#10135

Open
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/solid-query-queryOptions-runtime
Open

test(solid-query/queryOptions): add runtime test for identity function behavior#10135
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/solid-query-queryOptions-runtime

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 14, 2026

🎯 Changes

Add a runtime test for queryOptions to verify it returns the received object without any modification, consistent with the existing test in 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 unit test coverage for the queryOptions utility to confirm it returns the exact same object instance passed in (verifies no modification or cloning).
    • Ensures behavior is preserved by asserting strict equality between input and output.

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2026

⚠️ No Changeset found

Latest commit: 29a4226

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 14, 2026

📝 Walkthrough

Walkthrough

Adds a new Vitest unit test that asserts queryOptions returns the exact same object passed to it (no mutation), using a single test case and strict equality.

Changes

Cohort / File(s) Summary
Test Implementation
packages/solid-query/src/__tests__/queryOptions.test.tsx
Adds a Vitest unit test verifying queryOptions returns the input object unchanged (strict equality assertion).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tiny test I hopped to write,
pass the object, keep it tight.
No changes made, unchanged it stays,
I nibble bugs and sing hoorays! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a runtime test for queryOptions to verify its identity function behavior, which matches the actual test addition in the changeset.
Description check ✅ Passed The PR description follows the required template with all sections completed: Changes section explains the purpose, Checklist items are marked appropriately, and Release Impact correctly indicates this is dev-only with no changeset needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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

@nx-cloud
Copy link

nx-cloud bot commented Feb 14, 2026

View your CI Pipeline Execution ↗ for commit 29a4226

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

☁️ Nx Cloud last updated this comment at 2026-02-14 03:51:42 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 14, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 29a4226

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

🤖 Fix all issues with AI agents
In `@packages/solid-query/src/__tests__/queryOptions.test.tsx`:
- Around line 6-12: The test currently uses toStrictEqual which allows clones to
pass; change the assertion to use reference equality so it verifies the same
object instance is returned—update the test in queryOptions.test.tsx to replace
expect(queryOptions(object)).toStrictEqual(object) with
expect(queryOptions(object)).toBe(object) so the queryOptions function's
identity contract (returning the same object) is correctly asserted.

Comment on lines 6 to 12
it('should return the object received as a parameter without any modification.', () => {
const object: SolidQueryOptions = {
queryKey: ['key'],
queryFn: () => Promise.resolve(5),
} as const

expect(queryOptions(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

Use referential equality to validate identity.

toStrictEqual will pass even if queryOptions returns a cloned object. For “returns the same object” semantics, assert reference equality with toBe.

✅ Proposed change
-    expect(queryOptions(object)).toStrictEqual(object)
+    expect(queryOptions(object)).toBe(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
it('should return the object received as a parameter without any modification.', () => {
const object: SolidQueryOptions = {
queryKey: ['key'],
queryFn: () => Promise.resolve(5),
} as const
expect(queryOptions(object)).toStrictEqual(object)
it('should return the object received as a parameter without any modification.', () => {
const object: SolidQueryOptions = {
queryKey: ['key'],
queryFn: () => Promise.resolve(5),
} as const
expect(queryOptions(object)).toBe(object)
})
🤖 Prompt for AI Agents
In `@packages/solid-query/src/__tests__/queryOptions.test.tsx` around lines 6 -
12, The test currently uses toStrictEqual which allows clones to pass; change
the assertion to use reference equality so it verifies the same object instance
is returned—update the test in queryOptions.test.tsx to replace
expect(queryOptions(object)).toStrictEqual(object) with
expect(queryOptions(object)).toBe(object) so the queryOptions function's
identity contract (returning the same object) is correctly asserted.

@sukvvon sukvvon force-pushed the test/solid-query-queryOptions-runtime branch from db6568b to 29a4226 Compare February 14, 2026 03:48
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