test(query-devtools/Devtools): add tests for mutation details, sort order, and filter#10686
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)
📝 WalkthroughWalkthroughThis pull request adds three new test cases to the Devtools test suite, extending coverage for mutations functionality. The tests verify mutation details panel display, sort order persistence in localStorage, and mutation filtering by key within the Mutations view. ChangesMutation Devtools Test Coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
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 8af6d5b
☁️ 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: 2
🤖 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 599-608: The test currently only asserts the existence of the
localStorage key for mutation sort order; update the test in the 'should toggle
the mutation sort order in the mutations view' case to read the current value
from localStorage (key 'TanstackQueryDevtools.mutationSortOrder') before
clicking the 'Sort order' control (use renderDevtools and getByLabelText(/Sort
order/)), perform the click, then assert that the stored value has changed
(e.g., is not equal to the initial value); optionally click again and assert it
toggles back to the original value to verify a true toggle behavior.
- Around line 612-630: The test "should filter mutations by their submission
timestamp" is currently nondiscriminating because it only creates one mutation
and then filters, so add a second mutation whose mutationKey does NOT match
'filter-test' (e.g., ['other-mutation']) by using
queryClient.getMutationCache().build(...) and executing it, then assert the
rendered mutations list contains two items before applying the filter (use
renderDevtools() output queries such as getAllByLabelText(/Mutation submitted
at/) or a container query), perform the existing filter input via
fireEvent.input(rendered.getByLabelText('Filter queries by query key'), {
target: { value: 'filter-test' } }), and finally assert the list shrinks to one
item after filtering to prove the filter actually excludes the non-matching
mutation; keep using renderDevtools, queryClient, and getByLabelText to locate
elements.
🪄 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: 3d87417e-3838-444b-ac0d-9714cd0e0a1c
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx
size-limit report 📦
|
…rder' and exclusion in mutation filter
🎯 Changes
Add tests for the mutation-side interactions in the
Devtoolsbody component.mutation details— selecting a mutation:mutation sort order— sort order toggle in the mutations view:'TanstackQueryDevtools.mutationSortOrder'tolocalStorageand toggles its value across consecutive clicks.mutation filter— filter input in the mutations view:mutationKey, asserting that a non-matching mutation is excluded from the rendered list.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
Release Notes