package server import ( "net/http" "net/http/httptest" "strings" "testing" ) func TestHealth(t *testing.T) { srv := New(nil) req := httptest.NewRequest(http.MethodGet, "/api/health", nil) rec := httptest.NewRecorder() srv.Engine().ServeHTTP(rec, req) if rec.Code != http.StatusOK { t.Fatalf("status = %d, want %d", rec.Code, http.StatusOK) } if body := rec.Body.String(); !strings.Contains(body, `"status":"ok"`) { t.Fatalf("unexpected body: %s", body) } }