Skip to content

Commit 9c61a8b

Browse files
michaelmcneesclaude
andcommitted
test(budget): add rolling year-boundary test for CurrentPeriodStart
Verify AddDate(0,-1,0) correctly crosses year boundary (Jan 10 with resetDay 15 yields Dec 15 of prior year). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 57e5c34 commit 9c61a8b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/budget/budget_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ func TestCurrentPeriodStart_Rolling(t *testing.T) {
3030
assert.Equal(t, time.Date(2026, 3, 15, 0, 0, 0, 0, time.UTC), start)
3131
}
3232

33+
func TestCurrentPeriodStart_RollingYearBoundary(t *testing.T) {
34+
now := time.Date(2026, 1, 10, 0, 0, 0, 0, time.UTC)
35+
start := budget.CurrentPeriodStart(now, "rolling", 15)
36+
assert.Equal(t, time.Date(2025, 12, 15, 0, 0, 0, 0, time.UTC), start)
37+
}
38+
3339
func TestCurrentPeriodStart_RollingDay28_February(t *testing.T) {
3440
now := time.Date(2026, 3, 10, 0, 0, 0, 0, time.UTC)
3541
start := budget.CurrentPeriodStart(now, "rolling", 28)

0 commit comments

Comments
 (0)