Skip to content

test(store): add coverage for store get method and bound destructuring - #394

Closed
grzdev wants to merge 2 commits into
TanStack:mainfrom
grzdev:test/store-core-coverage-suite
Closed

grzdev wants to merge 2 commits into
TanStack:mainfrom
grzdev:test/store-core-coverage-suite

Conversation

@grzdev

@grzdev grzdev commented Oct 11, 2026 •

Copy link
Copy Markdown

🎯 Changes

Adds unit tests covering the get() getter method across both Store and ReadonlyStore in @tanstack/store (packages/store/src/store.ts):

  • Validates Store.prototype.get() returns the current state value
  • Verifies method context remains bound upon destructuring alongside setState
  • Validates ReadonlyStore.prototype.get() accurately reflects derived computations following base store state updates

✅ 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 confirming that store reads return the latest state and remain available after destructuring, including for derived stores.

@changeset-bot

changeset-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8f3ee9e

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: 5dc2576d-81de-49ad-86bc-c6bf5537133a
📥 Commits

Reviewing files that changed from the base of the PR and between 4178a98 and 8f3ee9e.

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: eeb72fde-9c0c-4b04-8312-71c884ac728a
📥 Commits

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

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

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

📝 Walkthrough

Walkthrough

The change adds tests for writable store get() behavior, including after destructuring and state updates, and for derived store get() values before and after base store updates.

Changes

Store get() behavior

Layer / File(s) Summary
Writable and derived store get() tests
packages/store/tests/store.test.ts
Tests check that a destructured writable store get() returns the current value after setState, and that a derived store get() reflects changes to its base store.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 4178a

The tests cover the stated store get() behaviors, with no identified issue blocking merge.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding store tests for the get method and bound destructuring.
Description check Passed The description includes all required sections, explains the test coverage and motivation, records local validation, and identifies the change as tests/CI/dev-only with no changeset required.
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