Skip to content

test(query-devtools/Explorer): add tests for 'Map' and iterable rendering branches#10721

Merged
sukvvon merged 1 commit into
mainfrom
test/query-devtools-explorer-collection-branches
May 18, 2026
Merged

test(query-devtools/Explorer): add tests for 'Map' and iterable rendering branches#10721
sukvvon merged 1 commit into
mainfrom
test/query-devtools-explorer-collection-branches

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 18, 2026

🎯 Changes

Extend Explorer.test.tsx with tests for the Map / iterable branches in subEntries and type memos. These branches were previously uncovered by the Devtools.test.tsx integration tests because user query data rarely uses Map / Set instances.

Added cases under a new Map and iterable values describe:

  • should preserve "Map" keys as labels when expanded
  • should mark an iterable value with an "(Iterable)" prefix on the expander
  • should render iterable children under their numeric index when expanded

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for Map and iterable value rendering behavior in the Explorer component.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

📝 Walkthrough

Walkthrough

This PR adds a new test suite to Explorer.test.tsx that verifies Map and iterable rendering behavior. The tests confirm that Map entries preserve their original keys as labels, iterable expanders include an "(Iterable)" prefix, and expanded iterable children render under numeric index labels.

Changes

Explorer Map and iterable rendering tests

Layer / File(s) Summary
Map and iterable value rendering tests
packages/query-devtools/src/__tests__/Explorer.test.tsx
New describe('Map and iterable values') test suite validates that Map entries display original keys, iterable expanders show "(Iterable)" prefix, and iterable children render with numeric index labels (e.g., 0:, 1:) after expansion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • TanStack/query#10714: Extends the same Explorer.test.tsx suite by adding coverage for Map and generic iterable expansion branches, building on earlier Explorer rendering tests.

Suggested labels

package: query-devtools

Poem

🐰 Maps and Sets now pass their test,
With keys and labels standing best,
Iterables marked with prefix true,
Indexed children showing through!
The Explorer shines, bugs now few.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding tests for Map and iterable rendering branches in Explorer.test.tsx.
Description check ✅ Passed The description follows the template with complete sections, including clear explanation of changes, checked checklist items, and appropriate release impact designation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/query-devtools-explorer-collection-branches

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 18, 2026

View your CI Pipeline Execution ↗ for commit 34d7877

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 27s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-18 00:29:43 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/vue-query 5.100.10 → 5.100.11 Changeset
@tanstack/vue-query-devtools 6.1.29 → 6.1.30 Changeset
@tanstack/angular-query-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/angular-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/eslint-plugin-query 5.100.10 → 5.100.11 Dependent
@tanstack/lit-query 0.2.1 → 0.2.2 Dependent
@tanstack/preact-query 5.100.10 → 5.100.11 Dependent
@tanstack/preact-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/preact-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/query-async-storage-persister 5.100.10 → 5.100.11 Dependent
@tanstack/query-broadcast-client-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/query-core 5.100.10 → 5.100.11 Dependent
@tanstack/query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/query-persist-client-core 5.100.10 → 5.100.11 Dependent
@tanstack/query-sync-storage-persister 5.100.10 → 5.100.11 Dependent
@tanstack/react-query 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-next-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/svelte-query 6.1.29 → 6.1.30 Dependent
@tanstack/svelte-query-devtools 6.1.29 → 6.1.30 Dependent
@tanstack/svelte-query-persist-client 6.1.29 → 6.1.30 Dependent

@sukvvon sukvvon self-assigned this May 18, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/query-devtools/src/__tests__/Explorer.test.tsx (2)

151-161: ⚡ Quick win

Consider verifying the rendered values for completeness.

Similar to the array test (lines 95-107), which verifies both index labels (0:, 1:) AND values ("a", "b"), this test could also assert that the Set values ("x", "y") are rendered after expansion. This would improve test completeness and maintain consistency with the established pattern.

🧪 Suggested enhancement for test completeness
 fireEvent.click(rendered.getByRole('button', { expanded: false }))

 expect(rendered.getByText('0:')).toBeInTheDocument()
+expect(rendered.getByText('"x"')).toBeInTheDocument()
 expect(rendered.getByText('1:')).toBeInTheDocument()
+expect(rendered.getByText('"y"')).toBeInTheDocument()
🤖 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__/Explorer.test.tsx` around lines 151 -
161, The test "should render iterable children under their numeric index when
expanded" currently asserts the index labels only; update it to also verify the
Set's values are rendered after expansion by adding assertions that
rendered.getByText('x') and rendered.getByText('y') are in the document (locate
the test using the it(...) block and the renderExplorer call with label: 's' and
value: new Set(['x','y']) and the fireEvent.click on the expansion button).

125-138: ⚡ Quick win

Consider verifying the rendered values for completeness.

The test correctly verifies that Map keys are preserved as labels, but doesn't assert that the corresponding values (1 and 2) are rendered. The existing array test (lines 95-107) and object test (lines 109-121) both verify labels/indices AND values. Adding value assertions would improve test completeness and maintain consistency with the established pattern.

🧪 Suggested enhancement for test completeness
 fireEvent.click(rendered.getByRole('button', { expanded: false }))

 expect(rendered.getByText('first:')).toBeInTheDocument()
+expect(rendered.getByText('1')).toBeInTheDocument()
 expect(rendered.getByText('second:')).toBeInTheDocument()
+expect(rendered.getByText('2')).toBeInTheDocument()
🤖 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__/Explorer.test.tsx` around lines 125 -
138, Update the test "should preserve \"Map\" keys as labels when expanded" to
also assert that Map values are rendered: after using renderExplorer(...) and
firing the click on the expansion button
(fireEvent.click(rendered.getByRole('button', { expanded: false }))), add
expectations that the numeric values "1" and "2" appear (e.g.,
expect(rendered.getByText('1')).toBeInTheDocument() and
expect(rendered.getByText('2')).toBeInTheDocument()). This keeps the Map test
consistent with the array and object tests and uses the existing renderExplorer
helper and rendered query methods.
🤖 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__/Explorer.test.tsx`:
- Around line 151-161: The test "should render iterable children under their
numeric index when expanded" currently asserts the index labels only; update it
to also verify the Set's values are rendered after expansion by adding
assertions that rendered.getByText('x') and rendered.getByText('y') are in the
document (locate the test using the it(...) block and the renderExplorer call
with label: 's' and value: new Set(['x','y']) and the fireEvent.click on the
expansion button).
- Around line 125-138: Update the test "should preserve \"Map\" keys as labels
when expanded" to also assert that Map values are rendered: after using
renderExplorer(...) and firing the click on the expansion button
(fireEvent.click(rendered.getByRole('button', { expanded: false }))), add
expectations that the numeric values "1" and "2" appear (e.g.,
expect(rendered.getByText('1')).toBeInTheDocument() and
expect(rendered.getByText('2')).toBeInTheDocument()). This keeps the Map test
consistent with the array and object tests and uses the existing renderExplorer
helper and rendered query methods.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a811cc94-01ce-48d4-98c1-55d1da40e293

📥 Commits

Reviewing files that changed from the base of the PR and between 3ed5d63 and 34d7877.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/Explorer.test.tsx

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10721

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10721

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10721

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10721

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10721

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10721

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10721

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10721

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10721

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10721

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10721

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10721

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10721

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10721

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10721

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10721

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10721

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10721

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10721

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10721

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10721

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10721

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10721

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10721

commit: 34d7877

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

@sukvvon sukvvon merged commit 334161f into main May 18, 2026
15 of 17 checks passed
@sukvvon sukvvon deleted the test/query-devtools-explorer-collection-branches branch May 18, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant