feat(platform): expose missing sources per vehicle

This commit is contained in:
lingniu
2026-07-04 05:42:39 +08:00
parent bc6715b35b
commit 5e7c4b56ef
8 changed files with 44 additions and 2 deletions

View File

@@ -92,6 +92,18 @@ func TestHandlerVehicleCoverage(t *testing.T) {
if body.Data.Items[0].ServiceStatus.Status != "degraded" {
t.Fatalf("coverage row should expose degraded status, got %+v", body.Data.Items[0].ServiceStatus)
}
var rawBody struct {
Data Page[struct {
VIN string `json:"vin"`
MissingProtocols []string `json:"missingProtocols"`
}] `json:"data"`
}
if err := json.Unmarshal(rec.Body.Bytes(), &rawBody); err != nil {
t.Fatalf("response JSON should decode missing source evidence: %v body=%s", err, rec.Body.String())
}
if len(rawBody.Data.Items) == 0 || !containsString(rawBody.Data.Items[0].MissingProtocols, "YUTONG_MQTT") {
t.Fatalf("coverage row should expose missing canonical protocols, got %+v body=%s", rawBody.Data.Items, rec.Body.String())
}
}
func TestHandlerVehicleCoverageFiltersServiceStatus(t *testing.T) {