fix: use week-relative dates in retention chart test#184
Merged
ManukMinasyan merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Stabilizes the UserRetentionChartWidgetTest by anchoring the “new active” user signup and activity timestamps to the start of the current week, preventing week-boundary-dependent misclassification.
Changes:
- Anchor test timestamps to
now()->startOfWeek()to ensure user signup and activity fall in the same weekly interval. - Replace relative
subDays()timestamps for the “new active” user and related company creation with week-relative timestamps.
d91e54f to
a05af2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UserRetentionChartWidgetTestwas flaky because it usednow()->subDays(2)andnow()->subDays(1)for test data, which can cross a weekly interval boundary depending on which day of the week the test runs (e.g., Sunday vs Monday when Carbon weeks start on Monday).now()->startOfWeek(), ensuring the "new active" user and their activity always fall within the same weekly interval regardless of which day the test runs.Test plan
subDays(2)= Sunday, different week)UserRetentionChartWidgetTestpass after the fix