test(svelte-query/createMutation): add tests for 'MutationFunctionContext' passed to mutationFn and callbacks - #11442
test(svelte-query/createMutation): add tests for 'MutationFunctionContext' passed to mutationFn and callbacks#11442sukvvon wants to merge 1 commit into
Conversation
…text' passed to mutationFn and callbacks
|
View your CI Pipeline Execution ↗ for commit 9a99c5c
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview2 package(s) bumped directly, 23 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughAdded Svelte mutation tests for ChangesMutation context coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change expands Svelte Query mutation-context test coverage without changing published runtime code or release behavior. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
size-limit report 📦
|
🎯 Changes
Adds test coverage for
MutationFunctionContext(the{ client, meta, mutationKey }object passed as the last argument tomutationFnand every mutation callback) insvelte-query'screateMutation.svelte.test.tsandcreateMutation.test-d.ts, mirroring the coverage added forreact-query/preact-query(#11440) andsolid-query(#11441).createMutation.svelte.test.tshad zero existing context assertions, so this adds 5 runtime tests (one more than react/preact/solid) — the extra one covers a per-callonSuccesscontext, which in the other adapters was already incidentally covered by an existing test but has no equivalent here:onSuccessreceiving a non-undefinedonMutateResultalongsidecontextmutationFnaccessing the sameQueryClientinstance viacontext.clientcontext.mutationKeyreflecting themutationKeypassed tocreateMutationcontext.client.invalidateQueries()actually invalidating the cache from withinonSuccessonSuccessreceiving the sameQueryClientinstance viacontextEach new runtime test renders a small dedicated
.sveltecomponent (SuccessContext.svelte,InvalidateFromContext.svelte,PerCallSuccess.svelte,MutationFnContext.svelte), following this file's existing one-component-per-scenario convention.Type tests added:
contexttyped asMutationFunctionContextformutationFnand every hook-level callbackcontexttyped asMutationFunctionContextfor every per-callmutateoptioncontext.mutationKeytyped asMutationKey | undefined✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit