Files
felhom-controller/controller/internal/web/media_events_test.go
T

21 lines
634 B
Go

package web
import (
"testing"
"time"
)
// „Later" is tonight 03:30 Budapest time — or tomorrow's when it is already past 03:30.
func TestNextMediaLater(t *testing.T) {
loc, _ := time.LoadLocation("Europe/Budapest")
for now, want := range map[time.Time]string{
time.Date(2026, 10, 15, 21, 0, 0, 0, loc): "2026-10-16 03:30",
time.Date(2026, 10, 15, 2, 0, 0, 0, loc): "2026-10-15 03:30",
time.Date(2026, 10, 15, 3, 30, 0, 0, loc): "2026-10-16 03:30",
} {
if got := nextMediaLater(now).Format("2006-01-02 15:04"); got != want {
t.Errorf("now %s: later = %s, want %s", now.Format(time.RFC3339), got, want)
}
}
}