MCPcopy Index your code
hub / github.com/github/github-mcp-server / mustNewGHClient

Function mustNewGHClient

pkg/github/helper_test.go:197–208  ·  view source on GitHub ↗

mustNewGHClient creates a new GitHub client for testing. If httpClient is nil, a client with no options is created. The test fails immediately if client creation fails.

(t *testing.T, httpClient *http.Client)

Source from the content-addressed store, hash-verified

195// If httpClient is nil, a client with no options is created.
196// The test fails immediately if client creation fails.
197func mustNewGHClient(t *testing.T, httpClient *http.Client) *gogithub.Client {
198 t.Helper()
199 var client *gogithub.Client
200 var err error
201 if httpClient == nil {
202 client, err = gogithub.NewClient()
203 } else {
204 client, err = gogithub.NewClient(gogithub.WithHTTPClient(httpClient))
205 }
206 require.NoError(t, err)
207 return client
208}
209
210// expect is a helper function to create a partial mock that expects various
211// request behaviors, such as path, query parameters, and request body.

Calls

no outgoing calls

Tested by

no test coverage detected