package themis import ( "reflect" "testing" "time" ) func TestNextMonday(t *testing.T) { tests := []struct { name string seed string want string }{ { name: "on monday", seed: "2023-11-13T15:04:05Z07:00", want: "2023-11-13T15:04:05Z07:00", }, { name: "on sunday", seed: "2023-11-12T15:04:05Z07:00", want: "2023-11-13T15:04:05Z07:00", }, { name: "on tuesday", seed: "2023-11-14T15:04:05Z07:00", want: "2023-11-20T15:04:05Z07:00", }, { name: "on saturday", seed: "2023-11-18T15:04:05Z07:00", want: "2023-11-20T15:04:05Z07:00", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { seedt, _ := time.Parse(time.RFC3339, tt.seed) now = func() time.Time { return seedt } wantt, _ := time.Parse(time.RFC3339, tt.want) if got := NextMonday(); !reflect.DeepEqual(got, wantt) { t.Errorf("NextMonday() = %v, want %v", got, wantt) } }) } }