package task

import (
	"testing"
	"time"
)

func TestDailyCycleUsesUTCDay(t *testing.T) {
	svc := &Service{}
	cycle := svc.dailyCycle(time.Date(2026, 5, 8, 23, 30, 0, 0, time.FixedZone("riyadh", 3*60*60)))
	if cycle.Key != "2026-05-08" {
		t.Fatalf("daily cycle must use UTC day key: %+v", cycle)
	}
	if want := time.Date(2026, 5, 9, 0, 0, 0, 0, time.UTC).UnixMilli(); cycle.NextRefreshMS != want {
		t.Fatalf("next refresh must be next UTC midnight: got=%d want=%d", cycle.NextRefreshMS, want)
	}
}
