Files
lingniu-vehicle-ingest/go/vehicle-gateway/internal/realtime/openapi_test.go
2026-07-02 18:41:23 +08:00

26 lines
713 B
Go

package realtime
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestOpenAPIHandlerDocumentsRealtimeSnapshotAndLocation(t *testing.T) {
request := httptest.NewRequest(http.MethodGet, "/openapi.json", nil)
response := httptest.NewRecorder()
NewOpenAPIHandler().ServeHTTP(response, request)
if response.Code != http.StatusOK {
t.Fatalf("status = %d body=%s", response.Code, response.Body.String())
}
body := response.Body.String()
for _, want := range []string{`"/api/realtime/snapshots"`, `"/api/realtime/locations"`, `"vehicle_realtime_snapshot"`, `"vehicle_realtime_location"`} {
if !strings.Contains(body, want) {
t.Fatalf("openapi missing %s: %s", want, body)
}
}
}