Skip to content

test(store): add unit tests for shallow equality utility - #393

Closed
grzdev wants to merge 2 commits into
TanStack:mainfrom
grzdev:test/store-shallow-unit-tests
Closed

grzdev wants to merge 2 commits into
TanStack:mainfrom
grzdev:test/store-shallow-unit-tests

Conversation

@grzdev

@grzdev grzdev commented Oct 11, 2026 •

Copy link
Copy Markdown

🎯 Changes

Adds a dedicated unit test suite for the shallow equality helper in @tanstack/store (packages/store/src/shallow.ts), covering:

  • Primitive values, NaN, null, undefined, and identical references
  • Mismatched primitives and null/object boundaries
  • Shallow object comparisons (including property additions and differing values)
  • Symbol keys in object property comparisons
  • Arrays and length differences
  • Map instances (differing sizes and values)
  • Set instances (differing sizes and items)
  • Date instances

✅ Checklist

  • I have read the contributing guide
  • Tests pass locally (pnpm --filter @tanstack/store run test:lib)
  • ESLint passes locally (pnpm --filter @tanstack/store run test:eslint)
  • TypeScript type checks pass locally (pnpm --filter @tanstack/store run test:types)

🚀 Release Impact

  • Published package changes (requires changeset)
  • Tests / CI / Dev only

Summary by CodeRabbit

  • Tests
    • Added coverage for shallow comparisons across primitive values, references, objects, arrays, collections, and dates.

@changeset-bot

changeset-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2e5afb7

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

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: TanStack/store/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 85753fcd-19d4-479f-b8e8-4955f410d233
📥 Commits

Reviewing files that changed from the base of the PR and between d6f2882 and 2e5afb7.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: TanStack/store/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d508cda8-ca53-492f-98a5-04f8c3c034d2
📥 Commits

Reviewing files that changed from the base of the PR and between 51ddb30 and d6f2882.

📒 Files selected for processing (1)
  • packages/store/tests/shallow.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Walkthrough

Added Vitest coverage for shallow comparisons across primitives, references, objects, arrays, Maps, Sets, and Dates.

Changes

Shallow comparison test coverage

Layer / File(s) Summary
Shallow comparison cases
packages/store/tests/shallow.test.ts
Added equality and inequality cases for primitive values, references, plain objects, symbol-keyed properties, arrays, Maps, Sets, and Dates.

Priority: ⬇️ Low

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

Change: Other

Merge Risk: ⚪ Minimal · up to d6f28

The change adds shallow-equality tests without an identified merge-blocking issue.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check Passed The description explains the test coverage, records local validation, and identifies the change as tests-only. It includes all required sections. It does not explicitly confirm understanding of AI-ass…
Title check Passed The title clearly and concisely describes the main change: adding unit tests for the store shallow equality utility.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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 unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@TkDodo TkDodo closed this Oct 17, 2026
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.

2 participants