From e2bfcd8b2b3c70631afe96560adaf2a685fc557e Mon Sep 17 00:00:00 2001 From: John Roesler Date: Sun, 22 Oct 2023 08:54:22 -0500 Subject: [PATCH] another month test --- job_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/job_test.go b/job_test.go index 4c92a76d..b9142434 100644 --- a/job_test.go +++ b/job_test.go @@ -54,7 +54,7 @@ func TestMonthlyJob_next(t *testing.T) { expectedDurationToNextRun time.Duration }{ { - "same day", + "same day - before at time", []int{1}, nil, []time.Time{ @@ -64,6 +64,17 @@ func TestMonthlyJob_next(t *testing.T) { time.Date(2000, 1, 1, 5, 30, 0, 0, time.UTC), 5*time.Hour + 30*time.Minute, }, + { + "same day - after at time, runs next available date", + []int{1, 10}, + nil, + []time.Time{ + time.Date(0, 0, 0, 5, 30, 0, 0, time.UTC), + }, + time.Date(2000, 1, 1, 5, 30, 0, 0, time.UTC), + time.Date(2000, 1, 10, 5, 30, 0, 0, time.UTC), + 9 * 24 * time.Hour, + }, { "daylight savings time", []int{5}, @@ -87,7 +98,7 @@ func TestMonthlyJob_next(t *testing.T) { 2 * 24 * time.Hour, }, { - "day not in current month, runs next month", + "day not in current month, runs next month (leap year)", []int{31}, nil, []time.Time{