MCPcopy Create free account
hub / github.com/bodaay/HuggingFaceModelDownloader / TestAPI_Health

Function TestAPI_Health

internal/server/api_test.go:30–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestAPI_Health(t *testing.T) {
31 srv := newTestServer()
32
33 req := httptest.NewRequest("GET", "/api/health", nil)
34 w := httptest.NewRecorder()
35
36 srv.handleHealth(w, req)
37
38 if w.Code != http.StatusOK {
39 t.Errorf("Expected 200, got %d", w.Code)
40 }
41
42 var resp map[string]any
43 json.Unmarshal(w.Body.Bytes(), &resp)
44
45 if resp["status"] != "ok" {
46 t.Errorf("Expected status ok, got %v", resp["status"])
47 }
48 if v, _ := resp["version"].(string); v == "" {
49 t.Errorf("Expected non-empty version string, got %v", resp["version"])
50 }
51}
52
53func TestAPI_GetSettings(t *testing.T) {
54 srv := newTestServer()

Callers

nothing calls this directly

Calls 2

newTestServerFunction · 0.85
handleHealthMethod · 0.80

Tested by

no test coverage detected