Skip to content

test(solid-query/useMutation): split 'should pass meta to mutation' into separate success and error tests#10949

Merged
sukvvon merged 1 commit into
mainfrom
test/solid-query-split-meta-test
Jun 14, 2026
Merged

test(solid-query/useMutation): split 'should pass meta to mutation' into separate success and error tests#10949
sukvvon merged 1 commit into
mainfrom
test/solid-query-split-meta-test

Conversation

@sukvvon

@sukvvon sukvvon commented Jun 14, 2026

Copy link
Copy Markdown
Member

🎯 Changes

The should pass meta to mutation test bundled two independent scenarios into one block: it set up two separate useMutation calls (one resolving, one throwing) in a single component and asserted both the success-meta and error-meta paths together. These are unrelated behaviors, so each is split into its own focused test.

  • Split into should pass meta to mutation on success (only the resolving mutation + onSuccess cache callback) and should pass meta to mutation on error (only the throwing mutation + onError cache callback).
  • Mirrors the same split already applied to react-query and preact-query.

No assertions are lost — each new test keeps the exact expectations for its path. The useMutation suite passes.

✅ 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
    • Improved test coverage for mutation meta values by splitting previously combined test cases into isolated scenarios for onSuccess and onError callbacks.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cb16575-1e3b-41b4-b6a3-880abfac5306

📥 Commits

Reviewing files that changed from the base of the PR and between 4154613 and 9da43ee.

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

📝 Walkthrough

Walkthrough

The combined useMutation test for "meta passed to mutation" is split into two separate it(...) blocks: one verifying MutationCache.onSuccess receives the correct mutation.meta value, and another verifying MutationCache.onError does the same, each with isolated setup, UI interaction, and assertions.

Changes

Split useMutation meta tests into success and error cases

Layer / File(s) Summary
Meta-on-success isolated test
packages/solid-query/src/__tests__/useMutation.test.tsx
New it(...) block wires MutationCache.onSuccess to read mutation.meta, triggers success via "succeed" button, and asserts the success UI marker renders and the success mock is called with the expected meta message.
Meta-on-error isolated test
packages/solid-query/src/__tests__/useMutation.test.tsx
New it(...) block adds MutationCache.onError handler with metaErrorMessage, renders only the error button trigger and errorTest marker, clicks "error", and asserts both the marker presence and the error mock invocation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • TanStack/query#10947: Performs the same split of the "meta passed to mutation" test into separate onSuccess/onError cases in the same test file.
  • TanStack/query#10948: Refactors useMutation tests by splitting combined success/error coverage into separate onSuccess vs onError test cases with distinct assertions, directly parallel to this PR.
  • TanStack/query#10915: Modifies the same useMutation.test.tsx file around onSuccess/onError mutation callback behavior.

Poem

🐇 Hoppity hop, one test became two,
Success on the left, error on the right in view,
Each it(...) block stands proud and alone,
No shared mutation, just meta well-known.
The cache callbacks checked, the markers shine bright—
A cleaner test suite, everything right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: splitting a combined test into two focused success and error tests for the useMutation test suite.
Description check ✅ Passed The description fully addresses the template requirements with detailed changes explanation, completed checklist items, and clear release impact classification as dev-only.
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/solid-query-split-meta-test

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

@sukvvon sukvvon self-assigned this Jun 14, 2026
@nx-cloud

nx-cloud Bot commented Jun 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 9da43ee

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

☁️ Nx Cloud last updated this comment at 2026-06-14 17:22:00 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 14, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 9da43ee

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon merged commit 6048592 into main Jun 14, 2026
9 checks passed
@sukvvon sukvvon deleted the test/solid-query-split-meta-test branch June 14, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant