package qaopsmirror import ( "testing" "time" ) func TestDashboardPeriodsUseBeijingAndPreviousSundayAtExclusiveEnd(t *testing.T) { end := time.Date(2026, 11, 2, 0, 0, 0, 0, time.FixedZone("CST", 8*3600)) month, week := dashboardPeriods(end) if month.Format(time.RFC3339) != "2026-11-01T00:00:00+08:00" || week.Format(time.RFC3339) != "2026-10-26T00:00:00+08:00" { t.Fatal("exclusive Monday end was assigned to the wrong source week/month") } } func TestDashboardFrozenGapsNeverUseCurrentRates(t *testing.T) { start := time.Date(2026, 9, 28, 0, 0, 0, 0, time.FixedZone("CST", 8*3600)) end := start.AddDate(0, 0, 21) points := dashboardFrozenSeries(start, end, nil) if len(points) != 3 { t.Fatal("must include each source natural week including missing snapshots") } for _, point := range points { if point.FrozenAt != nil || point.Coverage.Percent != nil || point.Correctness.Percent != nil { t.Fatal("missing historical snapshots were fabricated from current data") } } }