Fix flaky isLaterThanDays date test - #6690
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. Walkthrough
ChangesDate comparison updates
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to The change makes date comparisons deterministic without changing existing default behavior. Targeted tests, including the five-day boundary, pass, so the PR is mergeable. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 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. A rabbit reads each line, Comment |
andremion
left a comment
There was a problem hiding this comment.
Looks good, the injected now makes the boundary case deterministic. One naming nit inline, optional.
|
|
🚀 Available in v6.44.0 |


Goal
DateExtensionsTestsflakes on CI. The "exactly as old as specified days" case builds a datenow - 5 daysand expectsisLaterThanDays(5 days)to be false, butisLaterThanDaysreads the clock again internally, so it only holds when both reads land in the same millisecond. Any tick between them flips the result and fails the test.Closes AND-1514
Implementation
now: Date = Date()parameter toisLaterThanDaysso the reference instant can be injected. Production callers use the default and are unchanged.nowand pass it in, removing the wall-clock dependence from the whole suite.Both are
internal, so no public API change.Testing
:stream-chat-android-client:testDebugUnitTest --tests "*DateExtensionsTests"passes; the boundary case is now deterministic.Summary by CodeRabbit