feat(platform): surface overview consistency

This commit is contained in:
lingniu
2026-07-04 04:06:54 +08:00
parent db70f58a7c
commit 7b801b6f71
9 changed files with 83 additions and 24 deletions

View File

@@ -276,6 +276,9 @@ func TestHandlerVehicleServiceOverviewEndpoint(t *testing.T) {
if body.Data.ServiceStatus == nil || body.Data.ServiceStatus.Status != "degraded" || body.Data.ServiceStatus.Title != "部分来源离线" {
t.Fatalf("overview endpoint should expose canonical service status, got %+v", body.Data.ServiceStatus)
}
if body.Data.SourceConsistency == nil || body.Data.SourceConsistency.SourceCount != 2 || body.Data.SourceConsistency.OnlineSourceCount != 1 {
t.Fatalf("overview endpoint should expose source consistency, got %+v", body.Data.SourceConsistency)
}
if strings.Contains(rec.Body.String(), `"raw"`) || strings.Contains(rec.Body.String(), `"history"`) {
t.Fatalf("overview endpoint should not return heavy detail pages: %s", rec.Body.String())
}
@@ -330,6 +333,9 @@ func TestHandlerVehicleServiceOverviewsEndpoint(t *testing.T) {
if body.Data.Items[0].ServiceStatus == nil || body.Data.Items[1].ServiceStatus == nil {
t.Fatalf("batch overview should include canonical status for every vehicle, got %+v", body.Data.Items)
}
if body.Data.Items[0].SourceConsistency == nil || body.Data.Items[0].SourceConsistency.SourceCount != 2 {
t.Fatalf("batch overview should include source consistency, got %+v", body.Data.Items[0].SourceConsistency)
}
if strings.Contains(rec.Body.String(), `"raw"`) || strings.Contains(rec.Body.String(), `"history"`) {
t.Fatalf("batch overview should not return heavy detail pages: %s", rec.Body.String())
}