test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177
test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177sukvvon wants to merge 2 commits intoTanStack:mainfrom
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new unit test was added to the svelte-query package that asserts Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 58afb95
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
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.
| initialPageParam: null, | ||
| } | ||
|
|
||
| expect(infiniteQueryOptions(object)).toStrictEqual(object) |
There was a problem hiding this comment.
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.
| 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.
… 'as const' for consistency
🎯 Changes
Add a runtime test for
infiniteQueryOptionsidentity function in@tanstack/svelte-query, matching the existing test in@tanstack/react-query.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit