fix: birthday not yet reached this year test#214
fix: birthday not yet reached this year test#214kashifkhan0771 merged 1 commit intokashifkhan0771:mainfrom
Conversation
WalkthroughThe pull request fixes a test bug in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
time/time_test.go (1)
498-506: LGTM! Clean fix for the December overflow bug.The helper function correctly handles the month overflow by wrapping to January and incrementing the birth year. This ensures that when tests run in December, the calculated birth date is in January of the following year, which properly represents a "future" birthday.
Consider using the
time.Decemberconstant for improved readability:- if futureMonth > 12 { + if futureMonth > time.December { futureMonth = 1 year++ // If we overflow to next year, change birth year }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
time/time_test.go(1 hunks)
🔇 Additional comments (1)
time/time_test.go (1)
513-513: Consider verifying the month arithmetic for edge cases.Line 513 uses
(testTime.Month()+11)%12+1for calculating the previous month, which has a similar pattern to the bug fixed in this PR. WhentestTimeis January, this formula produces January (not December of the previous year), which might not correctly represent the intended behavior for the "Birthday already passed this year" test case.
|
Thank you @Lach-dev |
* feat: Added log redaction for sensitive information * fix: birthday not yet reached this year test (#214) * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Kashif Khan <[email protected]> * fixed linter issue in logging.go Signed-off-by: Kashif Khan <[email protected]> --------- Signed-off-by: Kashif Khan <[email protected]> Co-authored-by: Kashif Khan <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description:
The test case "Birthday not yet reached this year" had an issue. It will always fail in December due to the month overflow making it January. The logic creates a future month but doesn't properly handle the year calculation when adjusting for birth year.
Changes:
Checklist:
make test.make lint.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.