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

Function TestClientToplevelDirReportsNonRepository

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

Source from the content-addressed store, hash-verified

1076}
1077
1078func TestClientToplevelDirReportsNonRepository(t *testing.T) {
1079 // Given a client outside a Git repository
1080 IsolateConfig(t)
1081 client := Client{RepoDir: t.TempDir()}
1082
1083 // When the top-level directory is requested
1084 dir, err := client.ToplevelDir(t.Context())
1085
1086 // Then Git's repository error is returned
1087 require.Error(t, err)
1088 var gitError *GitError
1089 require.ErrorAs(t, err, &gitError)
1090 assert.Equal(t, 128, gitError.ExitCode)
1091 assert.Empty(t, dir)
1092}
1093
1094func TestClientGitDirReturnsRepositoryMetadataDirectory(t *testing.T) {
1095 // Given a local Git repository

Callers

nothing calls this directly

Calls 5

ToplevelDirMethod · 0.95
IsolateConfigFunction · 0.85
EqualMethod · 0.80
EmptyMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected