Conversation
…ror trigger via select
📝 WalkthroughWalkthroughA new test suite validates the error type selector feature in the devtools query editor. Two test cases verify that the error-type selection UI renders when ChangesError Type Select Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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 docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit b428f5b
☁️ 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.
🧹 Nitpick comments (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx (1)
712-733: ⚡ Quick winAssert selected error payload, not only
status.Line 730 currently proves the query enters error state, but it can still pass if selection ignores the chosen error type and uses a generic/default error. Add an assertion for the actual error object/message from the selected initializer.
Proposed test tightening
- expect(queryClient.getQueryState(['error-select-trigger'])?.status).toBe( - 'error', - ) + const state = queryClient.getQueryState(['error-select-trigger']) + expect(state?.status).toBe('error') + expect((state?.error as Error)?.message).toBe('Network')🤖 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/query-devtools/src/__tests__/Devtools.test.tsx` around lines 712 - 733, The test currently only asserts the query status becomes 'error'; update the assertion to also verify the actual error payload created by the selected initializer is applied: after triggering the select in the test (the entry using renderDevtools and errorTypes with initializer() => new Error('Network')), read the query state via queryClient.getQueryState(['error-select-trigger']) and assert its .error (or .error.message) equals the expected Error produced by the initializer (e.g., message 'Network' and/or that it's an Error instance). This ensures the selection uses the chosen initializer rather than a generic default.
🤖 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/query-devtools/src/__tests__/Devtools.test.tsx`:
- Around line 712-733: The test currently only asserts the query status becomes
'error'; update the assertion to also verify the actual error payload created by
the selected initializer is applied: after triggering the select in the test
(the entry using renderDevtools and errorTypes with initializer() => new
Error('Network')), read the query state via
queryClient.getQueryState(['error-select-trigger']) and assert its .error (or
.error.message) equals the expected Error produced by the initializer (e.g.,
message 'Network' and/or that it's an Error instance). This ensures the
selection uses the chosen initializer rather than a generic default.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 16d22058-b55f-4a79-80c7-cd3411234f8b
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx
size-limit report 📦
|
🎯 Changes
Add tests for the error type select that appears in the query details panel when
errorTypesis provided.error type select— error simulation via custom error types:errorTypesis provided.'error'when an error type is selected from the dropdown.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit