feat(platform): filter vehicle rows by service status
This commit is contained in:
@@ -49,6 +49,22 @@ func TestHandlerVehicles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehiclesFiltersServiceStatus(t *testing.T) {
|
||||
handler := NewHandler(NewService(NewMockStore()))
|
||||
rec := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodGet, "/api/vehicles?limit=10&serviceStatus=degraded", nil)
|
||||
handler.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
if !strings.Contains(rec.Body.String(), "LB9A32A24R0LS1426") {
|
||||
t.Fatalf("degraded vehicles should include partially online vehicle: %s", rec.Body.String())
|
||||
}
|
||||
if strings.Contains(rec.Body.String(), "LMRKH9AC2R1004087") {
|
||||
t.Fatalf("degraded vehicles should exclude healthy vehicle: %s", rec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehicleCoverage(t *testing.T) {
|
||||
handler := NewHandler(NewService(NewMockStore()))
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
Reference in New Issue
Block a user