test(query-core): expand notifyManager unit tests 🤖🤖🤖 - #11407
Conversation
Cover previously untested behaviors: empty batches do not invoke the scheduler, schedules outside of a batch notify each callback individually without the batch notify function, nested batches only flush at the outermost boundary, the batch callback's return value is passed through, schedules dispatch immediately after a batch threw (transaction counter is released), and the default scheduler defers notifications to a macrotask.
|
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; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds six ChangesnotifyManager behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds coverage for notifyManager batching, error recovery, return values, and scheduling behavior without changing runtime implementation. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
🎯 Changes
Expands the unit test coverage for
notifyManagerinpackages/query-core. The existing suite covered the happy paths of batching and customnotifyFn/batchNotifyFn/scheduler configuration; this PR adds behavioral coverage for the gaps that were not exercised:batch()call that schedules nothing does not invoke the scheduler at all (the flush no-op path).schedule()notifies its callback individually and does not route throughbatchNotifyFn, pinning the two distinct code paths ofschedule.batch()passes the callback's return value through to the caller.schedule()is dispatched immediately instead of being queued forever.setTimeout(0)) — draining microtasks alone does not flush them.Key assertions were verified against intentionally broken implementations (empty-batch flush guard, nested-batch flush guard) and go red, so they test behavior rather than implementation details.
Test-only change: no production source is modified.
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit