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) } } }