Tests for GetCurrentCommitHash
(t *testing.T)
| 102 | // Tests for GetCurrentCommitHash |
| 103 | |
| 104 | func TestGetCurrentCommitHash_Success(t *testing.T) { |
| 105 | tmpDir := t.TempDir() |
| 106 | setupGitRepo(t, tmpDir) |
| 107 | |
| 108 | createFile(t, tmpDir, "test.txt", "content") |
| 109 | gitAdd(t, tmpDir, "test.txt") |
| 110 | gitCommit(t, tmpDir, "Initial commit") |
| 111 | |
| 112 | hash, err := GetCurrentCommitHash(tmpDir) |
| 113 | |
| 114 | require.NoError(t, err) |
| 115 | assert.NotEmpty(t, hash) |
| 116 | // Short hash is typically 7 characters |
| 117 | assert.True(t, len(hash) >= 7 && len(hash) <= 12, "hash should be short format") |
| 118 | } |
| 119 | |
| 120 | func TestGetCurrentCommitHash_MatchesHEAD(t *testing.T) { |
| 121 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected