feat(platform): diagnose source consistency
This commit is contained in:
@@ -251,6 +251,12 @@ func TestHandlerVehicleServiceIncludesSourceConsistency(t *testing.T) {
|
||||
if consistency.MileageDeltaKm <= 0 || consistency.SourceTimeDeltaSeconds <= 0 {
|
||||
t.Fatalf("sourceConsistency should expose mileage and source time deltas, got %+v", consistency)
|
||||
}
|
||||
if consistency.Status == "" || consistency.Severity == "" || consistency.Title == "" || consistency.Detail == "" {
|
||||
t.Fatalf("sourceConsistency should expose actionable diagnosis, got %+v", consistency)
|
||||
}
|
||||
if consistency.Status != "degraded" || consistency.Title != "部分来源离线" {
|
||||
t.Fatalf("sourceConsistency should diagnose partial source health, got %+v", consistency)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehicleServiceOverviewEndpoint(t *testing.T) {
|
||||
@@ -279,6 +285,9 @@ func TestHandlerVehicleServiceOverviewEndpoint(t *testing.T) {
|
||||
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 body.Data.SourceConsistency.Status != "degraded" || body.Data.SourceConsistency.Title != "部分来源离线" {
|
||||
t.Fatalf("overview source consistency should expose diagnosis, 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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user