MCPcopy Create free account
hub / github.com/diillson/chatcli / TestGetGitInfo_NotInRepo

Function TestGetGitInfo_NotInRepo

utils/git_utils_test.go:50–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestGetGitInfo_NotInRepo(t *testing.T) {
51 mockExec := new(MockCommandExecutor)
52
53 // Configura o mock para falhar APENAS na verificação inicial
54 expectedErr := errors.New("exit status 1")
55 mockExec.On("Run", "git", []string{"rev-parse", "--is-inside-work-tree"}).Return(expectedErr)
56
57 _, err := GetGitInfo(mockExec)
58
59 assert.Error(t, err)
60 assert.Equal(t, "não é um repositório Git", err.Error())
61
62 // Garante que nenhum outro comando foi chamado
63 mockExec.AssertExpectations(t)
64 mockExec.AssertNumberOfCalls(t, "Run", 1)
65 mockExec.AssertNotCalled(t, "Output")
66}

Callers

nothing calls this directly

Calls 3

GetGitInfoFunction · 0.85
EqualMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected