feat(platform): summarize missing vehicle sources
This commit is contained in:
@@ -384,6 +384,24 @@ func TestHandlerVehicleServiceSummaryEndpoint(t *testing.T) {
|
||||
if !noDataStatusFound {
|
||||
t.Fatalf("summary service status distribution should include no_data, got %+v", body.Data.ServiceStatuses)
|
||||
}
|
||||
var rawBody struct {
|
||||
Data struct {
|
||||
MissingSources []struct {
|
||||
Protocol string `json:"protocol"`
|
||||
Count int `json:"count"`
|
||||
} `json:"missingSources"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &rawBody); err != nil {
|
||||
t.Fatalf("response JSON should decode raw summary: %v body=%s", err, rec.Body.String())
|
||||
}
|
||||
missing := map[string]int{}
|
||||
for _, source := range rawBody.Data.MissingSources {
|
||||
missing[source.Protocol] = source.Count
|
||||
}
|
||||
if missing["GB32960"] != 2 || missing["JT808"] != 2 || missing["YUTONG_MQTT"] != 3 {
|
||||
t.Fatalf("summary should expose canonical missing source counts, got %+v body=%s", missing, rec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehicleServiceOverviewsEndpoint(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user