feat(platform): expose service status on vehicle rows

This commit is contained in:
lingniu
2026-07-04 02:23:57 +08:00
parent 826fa76008
commit cbd02956ff
6 changed files with 81 additions and 11 deletions

View File

@@ -35,6 +35,18 @@ func TestHandlerVehicles(t *testing.T) {
if !strings.Contains(rec.Body.String(), "LB9A32A24R0LS1426") {
t.Fatalf("response missing vehicle: %s", rec.Body.String())
}
var body struct {
Data Page[VehicleRow] `json:"data"`
}
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
t.Fatalf("response JSON should decode: %v body=%s", err, rec.Body.String())
}
if len(body.Data.Items) == 0 || body.Data.Items[0].ServiceStatus == nil {
t.Fatalf("vehicle row should include canonical vehicle service status: %s", rec.Body.String())
}
if body.Data.Items[0].ServiceStatus.Status != "degraded" {
t.Fatalf("vehicle row should expose degraded status, got %+v", body.Data.Items[0].ServiceStatus)
}
}
func TestHandlerVehicleCoverage(t *testing.T) {