(t *testing.T)
| 48 | } |
| 49 | |
| 50 | func 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 | } |
nothing calls this directly
no test coverage detected