Skip to content

test(solid-query-devtools/devtools): add tests for forwarding 'buttonPosition' and 'position' props to the devtools instance#10819

Merged
sukvvon merged 2 commits into
mainfrom
test/solid-query-devtools-button-position-and-position-props
May 28, 2026
Merged

test(solid-query-devtools/devtools): add tests for forwarding 'buttonPosition' and 'position' props to the devtools instance#10819
sukvvon merged 2 commits into
mainfrom
test/solid-query-devtools-button-position-and-position-props

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 28, 2026

🎯 Changes

Mirrors the React (#10817) and Preact (#10818) adapter PRs for the Solid adapter. Until now SolidQueryDevtools only had smoke cases (no QueryClient, context, props); the two createEffects that thread buttonPosition / position into the core devtools instance (devtools.tsx:79-84 and :86-91) were entirely uncovered.

Because both `solid-query-devtools` and the underlying `@tanstack/query-devtools` are written in Solid, no module-level mock is needed — `vi.spyOn(TanstackQueryDevtools.prototype, ...)` observes the real instance while it runs:

  • should forward "buttonPosition" to the devtools instance: spies on `TanstackQueryDevtools.prototype.setButtonPosition`, renders ``, and asserts the spy was called with `'top-left'`, locking in the `if (buttonPos) devtools.setButtonPosition(buttonPos)` branch.
  • should forward "position" to the devtools instance: same shape for the `position` prop / `setPosition` call.

An `afterEach(vi.restoreAllMocks)` resets the prototype spies between cases so the existing smoke cases stay isolated.

Coverage for `devtools.tsx` goes 93.33% → 100% statements / 71.42% → 85.71% branches / 92% → 100% lines.

✅ 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
    • Enhanced test coverage to verify proper prop forwarding in the devtools component.

Review Change Stack

…Position' and 'position' props to the devtools instance
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 28, 2026

View your CI Pipeline Execution ↗ for commit b98f78b

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

☁️ Nx Cloud last updated this comment at 2026-05-28 08:15:20 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.6 → 0.2.7 Changeset
@tanstack/query-devtools 5.100.14 → 5.100.15 Changeset
@tanstack/angular-query-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/angular-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/eslint-plugin-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/query-async-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/query-broadcast-client-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/query-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-persist-client-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-sync-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/react-query 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-next-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/svelte-query 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-devtools 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-persist-client 6.1.33 → 6.1.34 Dependent
@tanstack/vue-query 5.100.14 → 5.100.15 Dependent
@tanstack/vue-query-devtools 6.1.33 → 6.1.34 Dependent

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7910c5ab-595b-4f24-a5c9-5a1188667c0b

📥 Commits

Reviewing files that changed from the base of the PR and between 9c8d2ea and 9f9c4c5.

📒 Files selected for processing (1)
  • packages/solid-query-devtools/src/__tests__/devtools.test.tsx

📝 Walkthrough

Walkthrough

The test suite for SolidQueryDevtools is updated with mock reset infrastructure via afterEach and two new test cases that verify the component forwards buttonPosition and position props to the underlying TanstackQueryDevtools instance methods.

Changes

Prop forwarding test coverage

Layer / File(s) Summary
Test cleanup infrastructure
packages/solid-query-devtools/src/__tests__/devtools.test.tsx
afterEach hook imported from vitest and called to restore all mocks after each test, ensuring test isolation.
Prop forwarding test cases
packages/solid-query-devtools/src/__tests__/devtools.test.tsx
New test cases spy on TanstackQueryDevtools prototype methods and assert SolidQueryDevtools forwards buttonPosition and position props via setButtonPosition and setPosition method calls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • TanStack/query#10817: Adds similar unit tests asserting prop forwarding of buttonPosition and position to underlying devtools instance methods.
  • TanStack/query#10818: Adds/verifies unit tests for devtools wrapper prop forwarding via setButtonPosition/setPosition method calls.

Suggested labels

package: query-devtools

Poem

🐰 A devtools suit gets tested today,
Props forwarded the proper way,
Mocks are reset when tests conclude,
Solid patterns, attitudes,
Query tools now verified—hooray! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding tests for forwarding the 'buttonPosition' and 'position' props to the devtools instance.
Description check ✅ Passed The description follows the template structure with completed 'Changes' section and fully checked 'Checklist' and 'Release Impact' sections, providing comprehensive context about test additions and coverage improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/solid-query-devtools-button-position-and-position-props

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

@sukvvon sukvvon self-assigned this May 28, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10819

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10819

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 9f9c4c5

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

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.

1 participant