Skip to content

test(query-devtools/utils): add tests for 'displayValue'#10646

Merged
sukvvon merged 1 commit intomainfrom
test/query-devtools-display-value
May 5, 2026
Merged

test(query-devtools/utils): add tests for 'displayValue'#10646
sukvvon merged 1 commit intomainfrom
test/query-devtools-display-value

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 5, 2026

🎯 Changes

Add unit tests for the displayValue helper in query-devtools/utils.tsx.

The helper takes superjson.serialize(value).json (discarding .meta) and runs it through JSON.stringify, with an optional beautify flag for indented multi-line output.

Cases:

  • Primitive sanity (string, number)
  • Composite sanity (object)
  • undefined'null' — exercises the "discard .meta" behavior
  • Default beautify (single-line)
  • beautify: true (indented multi-line)

External library behavior (superjson's handling of Date, Map, Set, NaN, etc.) is intentionally out of scope — those belong to superjson's own test suite.

✅ 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 value serialization and formatting capabilities, including validation of primitive handling, number formatting, object serialization, and display mode variations.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 5, 2026

View your CI Pipeline Execution ↗ for commit 5391177

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 28s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-05 18:15:06 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 5391177

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

size-limit report 📦

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5cf1a07f-1e75-471d-ae78-87c51bd531d8

📥 Commits

Reviewing files that changed from the base of the PR and between f4a365f and 5391177.

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

📝 Walkthrough

Walkthrough

This PR adds a test suite for the displayValue utility function, verifying how it stringifies and serializes various value types, including primitives, objects, and options for compact versus beautified output formatting.

Changes

displayValue Function Tests

Layer / File(s) Summary
Test Import & Setup
packages/query-devtools/src/__tests__/utils.test.ts (lines 3–4)
displayValue is imported from ../utils.
Test Suite
packages/query-devtools/src/__tests__/utils.test.ts (lines 805–829)
New describe('displayValue', ...) block asserts string outputs for primitives, numbers, object serialization via superjson (metadata discarded), undefined"null", default compact JSON format, and beautified multi-line format when beautify is true.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A tiny test hops into the warren,
Verifying how values dance and transform,
Strings, numbers, objects in a line,
Beautified or compact—both look fine,
displayValue now proven sound and true! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding tests for the 'displayValue' utility function in query-devtools.
Description check ✅ Passed The description follows the required template structure with complete 'Changes', 'Checklist', and 'Release Impact' sections, all properly filled out with relevant details.
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-display-value

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@sukvvon sukvvon self-assigned this May 5, 2026
@sukvvon sukvvon merged commit 3c24bc8 into main May 5, 2026
10 checks passed
@sukvvon sukvvon deleted the test/query-devtools-display-value branch May 5, 2026 18:18
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