Update comments, use correct ordering of args for assertions.
Этот коммит содержится в:
@@ -45,7 +45,7 @@ func GetNextTrueUpReviewDueDate(now time.Time) time.Time {
|
||||
|
||||
for _, window := range trueUpSubmissionWindows {
|
||||
withinWindow := false
|
||||
// Our due dates "wrap" around, so we'll need to check the months different. Since January = 1 and December = 12, the checks
|
||||
// Our due dates "wrap" around (i.e. can go into the next year), so we'll need to check the months different. Since January = 1 and December = 12, the checks
|
||||
// for the current month being greater or equal to the start month and less than or equal to the end month will not work.
|
||||
if window.End.Month() == time.January {
|
||||
withinWindow = (nowMonth != time.January && nowMonth >= window.Start.Month()) || nowMonth == window.End.Month()
|
||||
|
||||
@@ -14,19 +14,19 @@ import (
|
||||
func TestGetNextTrueUpReviewDueDate(t *testing.T) {
|
||||
t.Run("Due date always falls on the 15th", func(t *testing.T) {
|
||||
// Before the 15th
|
||||
now := time.Date(2022, 12, 14, 0, 0, 0, 0, time.Local)
|
||||
now := time.Date(2022, time.March, 14, 0, 0, 0, 0, time.Local)
|
||||
due := GetNextTrueUpReviewDueDate(now)
|
||||
assert.Equal(t, due.Day(), trueUpReviewDueDay)
|
||||
assert.Equal(t, trueUpReviewDueDay, due.Day())
|
||||
|
||||
// On the 15th
|
||||
now = time.Date(2022, 12, 15, 0, 0, 0, 0, time.Local)
|
||||
now = time.Date(2022, time.December, 15, 0, 0, 0, 0, time.Local)
|
||||
due = GetNextTrueUpReviewDueDate(now)
|
||||
assert.Equal(t, due.Day(), trueUpReviewDueDay)
|
||||
assert.Equal(t, trueUpReviewDueDay, due.Day())
|
||||
|
||||
// After the 15th
|
||||
now = time.Date(2022, 12, 16, 0, 0, 0, 0, time.Local)
|
||||
now = time.Date(2022, time.September, 16, 0, 0, 0, 0, time.Local)
|
||||
due = GetNextTrueUpReviewDueDate(now)
|
||||
assert.Equal(t, due.Day(), trueUpReviewDueDay)
|
||||
assert.Equal(t, trueUpReviewDueDay, due.Day())
|
||||
})
|
||||
|
||||
t.Run("Due date will always be in next quarter if the current date is past the 15th", func(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user