MCPcopy Create free account
hub / github.com/compozy/agh / TestCloseResponseBodyAndJoinErrors

Function TestCloseResponseBodyAndJoinErrors

internal/registry/github/client_test.go:1031–1048  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1029}
1030
1031func TestCloseResponseBodyAndJoinErrors(t *testing.T) {
1032 t.Parallel()
1033
1034 if err := closeResponseBody(nil, "nil body"); err != nil {
1035 t.Fatalf("closeResponseBody(nil) error = %v", err)
1036 }
1037
1038 closer := &stubCloser{err: errors.New("close failed")}
1039 err := closeResponseBody(closer, "test response")
1040 if err == nil || !strings.Contains(err.Error(), "close failed") {
1041 t.Fatalf("closeResponseBody() error = %v, want close failure", err)
1042 }
1043
1044 joined := joinErrors(errors.New("one"), nil, errors.New("two"))
1045 if joined == nil || !strings.Contains(joined.Error(), "one") || !strings.Contains(joined.Error(), "two") {
1046 t.Fatalf("joinErrors() = %v, want joined error", joined)
1047 }
1048}
1049
1050func newGitHubServer(t *testing.T, handler func(http.ResponseWriter, *http.Request)) *httptest.Server {
1051 t.Helper()

Callers

nothing calls this directly

Calls 4

closeResponseBodyFunction · 0.85
ContainsMethod · 0.80
joinErrorsFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected