test(query-devtools/Devtools): add test for 'pip_open' reset when the popup is blocked#10761
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a test that simulates the browser blocking the picture-in-picture popup by stubbing ChangesPicture-in-Picture Popup Blocked Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
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 docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 80c2c52
☁️ 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__/Devtools.test.tsx`:
- Around line 434-454: The test creates a spy via vi.spyOn(console, 'error')
(assigned to consoleError) but never restores it; wrap the test body inside a
try { ... } finally { consoleError.mockRestore() } block so the spy is always
restored after running renderDevtools and assertions, ensuring no leakage
between tests; reference the existing vi.stubGlobal('open', ...) and the
renderDevtools(...) call and ensure the finally block calls
consoleError.mockRestore() to clean up the spy (and optionally restore any other
stubs if present).
🪄 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: 399c4350-e9d6-4c5d-9a2b-2b2aaae43021
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx
size-limit report 📦
|
… popup is blocked
80c2c52 to
c73b449
Compare
🎯 Changes
Extend
Devtools.test.tsxwith a test that locks the popup-blocked fallback for the picture-in-picture window — whenwindow.openreturnsnull, thepip_openreactive effect should log the failure and reset the persistedpip_openflag so the user is not left in a broken state.Added cases (
picture-in-picture, 1):should log and reset "pip_open" when the browser blocks the popup— stubswindow.opento returnnull, seedspip_open=truein localStorage to trigger the auto-open effect, and asserts both theconsole.errorcall and thatpip_openis reset to"false".✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit