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

Function TestClientPushDefaultPropagatesGitError

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

Source from the content-addressed store, hash-verified

744}
745
746func TestClientPushDefaultPropagatesGitError(t *testing.T) {
747 // Given a client whose repository directory no longer exists
748 repo := newTestRepo(t)
749 require.NoError(t, os.RemoveAll(repo.dir))
750
751 // When push.default is read
752 pushDefault, err := repo.client.PushDefault(t.Context())
753
754 // Then the repository error is preserved
755 require.Error(t, err)
756 var gitError *GitError
757 require.ErrorAs(t, err, &gitError)
758 assert.Equal(t, 128, gitError.ExitCode)
759 assert.Empty(t, pushDefault)
760}
761
762func TestClientRemotePushDefaultReturnsEmptyWhenUnset(t *testing.T) {
763 // Given a repository without remote.pushDefault

Callers

nothing calls this directly

Calls 5

newTestRepoFunction · 0.85
EqualMethod · 0.80
EmptyMethod · 0.80
PushDefaultMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected