test(angular-query/inject-query): assert refetch queryKey outside the discarded promise callback - #11461
Conversation
… discarded promise callback
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe refetch test now advances timers explicitly before synchronous assertions. It verifies both refetch calls use the current signal-derived query key and checks the final data value. ChangesRefetch test validation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This test-only change makes refetch assertions execute after asynchronous timer advancement and verifies the final data value. It does not alter runtime behavior or public APIs, and no merge-blocking risk remains. 🚥 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 |
|
View your CI Pipeline Execution ↗ for commit 2df3e84
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview2 package(s) bumped directly, 23 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
size-limit report 📦
|
🎯 Changes
should use the current value for the queryKey when refetch is calledput its four assertions insidevoid query.refetch().then(() => { ... }). The promise is discarded, so an assertion failure inside the callback never reaches the test — the rejection has nowhere to go.That is not theoretical. On
main, changingtoHaveBeenCalledTimes(2)to999, or deleting thekeySignal.set('key12')line the test exists to cover, both still pass.expect.assertions(5)also passes, so the callbacks do run — they just cannot report a failure.Moving the assertions out of the callback, after the
advanceTimersByTimeAsyncthat was already there, makes both mutations fail as they should. The assertions themselves are unchanged.One assertion is added —
expect(query.data()).toBe('Some data')— since nothing else confirmed the refetch actually completed rather than merely being invoked.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit