test(query-devtools/DevtoolsComponent): add smoke test for rendering without throwing#10679
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Vitest + Solid test for DevtoolsComponent that mocks ChangesDevtoolsComponent Test Suite
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 22e1de5
☁️ Nx Cloud last updated this comment at |
🚀 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.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/query-devtools/src/__tests__/DevtoolsComponent.test.tsx`:
- Around line 14-29: Save the original window.localStorage descriptor before you
override it in the beforeEach, then add an afterEach that restores it (so the
mock doesn't leak between suites). Specifically, capture the original descriptor
(or value) of window.localStorage at the top of the test file or inside the
beforeEach setup, and in afterEach restore via Object.defineProperty(window,
'localStorage', originalDescriptor) or assign the saved value back; reference
the existing beforeEach override and ensure the cleanup runs after each test to
fully revert the mocked localStorage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bba7155b-0256-4431-8625-f8eae3dace98
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/DevtoolsComponent.test.tsx
size-limit report 📦
|
bc099da to
853d206
Compare
853d206 to
25d56cf
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/query-devtools/src/__tests__/DevtoolsComponent.test.tsx`:
- Line 16: The mocked getItem implementation in DevtoolsComponent.test.tsx
currently returns storage[key] || null which converts falsy stored values (like
empty string or "0") into null; update the mock getItem so it returns the actual
stored value when the key exists and only returns null when the key is absent
(e.g., check presence with Object.prototype.hasOwnProperty.call(storage, key) or
key in storage and return storage[key] otherwise null) to match the Storage API
contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b78b156f-8b6e-4b05-bc97-61f96c906356
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/DevtoolsComponent.test.tsx
25d56cf to
b5c4305
Compare
b5c4305 to
3c7572f
Compare
🎯 Changes
Add a smoke test for
DevtoolsComponent, the lightweight wrapper that wiresQueryDevtoolsContext,PiPProvider, andThemeContextaround the SolidDevtoolsbody.matchMediaandResizeObserverto satisfy jsdom.solid-transition-groupto bypass a transitive@solid-primitives/transition-groupexportsfield that Vite cannot resolve.localStoragesocreateLocalStoragefrom@solid-primitives/storagedoes not leak across tests.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit