test(solid-query-devtools/devtools): add tests for forwarding option changes after mount#11021
Conversation
…changes after mount
|
View your CI Pipeline Execution ↗ for commit 7f2d380
☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughAdds type-only imports from ChangesDevtools prop-forwarding test coverage
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/solid-query-devtools/src/__tests__/devtools.test.tsx (1)
150-244: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a table-driven test to reduce duplication.
All five tests share an identical structure (spy → signal → render → mockClear → update → assert). A parameterized
it.eachcould consolidate this into one test body, easing future maintenance if more props need coverage.♻️ Illustrative sketch (not exhaustive)
- it('should forward a "buttonPosition" change to the devtools instance after mount', () => { ... }) - it('should forward a "position" change to the devtools instance after mount', () => { ... }) - ... + it.each([ + ['buttonPosition', 'setButtonPosition', 'bottom-right', 'top-left'], + ['position', 'setPosition', 'bottom', 'top'], + ['theme', 'setTheme', 'light', 'dark'], + // initialIsOpen/errorTypes need separate handling due to non-boolean/array values + ])('should forward a "%s" change to the devtools instance after mount', (prop, setter, initial, updated) => { + // shared logic here + })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/solid-query-devtools/src/__tests__/devtools.test.tsx` around lines 150 - 244, The five forwarding tests in devtools.test.tsx are duplicated with the same spy/signal/render/mockClear/update/assert flow. Refactor them into a table-driven test using a single parameterized body (for example, around SolidQueryDevtools and the TanstackQueryDevtools prototype setters) so each prop case is described in data and future prop coverage can be added in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/solid-query-devtools/src/__tests__/devtools.test.tsx`:
- Around line 150-244: The five forwarding tests in devtools.test.tsx are
duplicated with the same spy/signal/render/mockClear/update/assert flow.
Refactor them into a table-driven test using a single parameterized body (for
example, around SolidQueryDevtools and the TanstackQueryDevtools prototype
setters) so each prop case is described in data and future prop coverage can be
added in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 87fd6306-da70-42a2-8dab-35d5baf9c40c
📒 Files selected for processing (1)
packages/solid-query-devtools/src/__tests__/devtools.test.tsx
size-limit report 📦
|
🎯 Changes
Adds regression tests verifying that
SolidQueryDevtoolsforwards option changes to the underlying devtools instance after mount, not just on the initial render.The existing tests only cover the initial forwarding of options. Each option is wired through its own
createEffectthat reads the reactiveprops, so if a value is read outside the effect (breaking reactivity), the option would silently stop being re-forwarded on update — a case the initial-render tests cannot catch.Since Solid components run once and update via signals (there is no
rerender), the new tests drive each prop with acreateSignaland update it after mount, asserting the corresponding setter is called again:buttonPositionpositioninitialIsOpenerrorTypestheme✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit