(t *testing.T)
| 397 | } |
| 398 | |
| 399 | func TestAPIClient_NetworkError(t *testing.T) { |
| 400 | // Create a server and immediately close it to simulate connection refused |
| 401 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) |
| 402 | serverURL := server.URL |
| 403 | server.Close() |
| 404 | |
| 405 | client := newTestClient(serverURL) |
| 406 | _, err := client.GET("/monitors", nil) |
| 407 | if err == nil { |
| 408 | t.Error("expected network error, got nil") |
| 409 | } |
| 410 | if !strings.Contains(err.Error(), "request failed") { |
| 411 | t.Errorf("expected 'request failed' in error, got %q", err.Error()) |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | func TestAPIClient_MalformedJSON(t *testing.T) { |
| 416 | mock := testutil.NewMockAPI() |
nothing calls this directly
no test coverage detected