Update comments, use correct ordering of args for assertions.

Этот коммит содержится в:
Conor Macpherson
2023-01-06 09:31:19 -05:00
родитель a826e60d79
Коммит 4f9f331184
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@@ -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) {