MCPcopy Create free account
hub / github.com/cli/cli / TestClientConfigPropagatesGitError

Function TestClientConfigPropagatesGitError

git/client_test.go:347–361  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

345}
346
347func TestClientConfigPropagatesGitError(t *testing.T) {
348 // Given a client whose repository directory does not exist
349 client := Client{RepoDir: filepath.Join(t.TempDir(), "missing")}
350
351 // When configuration is read
352 value, err := client.Config(t.Context(), "credential.helper")
353
354 // Then the Git error is returned unchanged
355 require.Error(t, err)
356 var gitErr *GitError
357 require.ErrorAs(t, err, &gitErr)
358 assert.NotZero(t, gitErr.ExitCode)
359 assert.Contains(t, gitErr.Stderr, client.RepoDir)
360 assert.Empty(t, value)
361}
362
363func TestClientUncommittedChangeCountReturnsZeroForCleanRepository(t *testing.T) {
364 // Given a clean repository

Callers

nothing calls this directly

Calls 5

ConfigMethod · 0.95
JoinMethod · 0.80
ContainsMethod · 0.80
EmptyMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected