test({react,preact}-query/useMutation): add tests for 'MutationFunctionContext' passed to mutationFn and callbacks - #11440
Conversation
|
View your CI Pipeline Execution ↗ for commit fc6622a
☁️ 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 (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds React and Preact type and runtime tests for ChangesMutation context coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds regression coverage for mutation callback context behavior across React and Preact without changing published runtime code. No merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 📦
|
…onContext' passed to mutationFn and callbacks
fc6622a to
d345fc2
Compare
🎯 Changes
Adds test coverage for
MutationFunctionContext(the{ client, meta, mutationKey }object passed as the last argument tomutationFnand every mutation callback) inuseMutation.test.tsxanduseMutation.test-d.tsx, for bothreact-queryandpreact-query.Runtime tests added:
onSuccessreceiving a non-undefinedonMutateResultalongsidecontextmutationFnaccessing the sameQueryClientinstance viacontext.clientcontext.mutationKeyreflecting themutationKeypassed touseMutationcontext.client.invalidateQueries()actually invalidating the cache from withinonSuccessType 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