test(angular-query-experimental/inject-mutation): add tests for 'MutationFunctionContext' passed to mutationFn and callbacks - #11443
Conversation
|
View your CI Pipeline Execution ↗ for commit 8054b78
☁️ 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 (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe changes add type and runtime tests for ChangesMutation context validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change expands Angular mutation-context test coverage without altering production 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 📦
|
…tionFunctionContext' passed to mutationFn and callbacks
8054b78 to
8ee77db
Compare
🎯 Changes
Adds test coverage for
MutationFunctionContext(the{ client, meta, mutationKey }object passed as the last argument tomutationFnand every mutation callback) inangular-query-experimental'sinject-mutation.test.tsandinject-mutation.test-d.ts, mirroring the coverage added forreact-query/preact-query(#11440),solid-query(#11441), andsvelte-query(#11442).This adds 5 runtime tests (one more than react/preact/solid, matching svelte). Four use this file's
TestBed.runInInjectionContext+vi.fn()"side effects" convention; themutationFn-reads-context.clienttest uses@Component+render()+getByText, matching this file's own convention for tests that assert rendered state rather than a mock's calls:onSuccessreceiving a non-undefinedonMutateResultalongsidecontextmutationFnaccessing the sameQueryClientinstance viacontext.client, rendered into the template and asserted withgetByTextcontext.mutationKeyreflecting themutationKeypassed toinjectMutationcontext.client.invalidateQueries()actually invalidating the cache from withinonSuccessonSuccessreceiving the sameQueryClientinstance viacontext— the existingshould call onSuccess when passed as an argument of mutate functiontest already exercises this call shape but never assertedcontext, so this fills that gap rather than duplicating itType 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