MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / TestGetCurrentCommitHash_Success

Function TestGetCurrentCommitHash_Success

vcs/git/git_test.go:104–118  ·  view source on GitHub ↗

Tests for GetCurrentCommitHash

(t *testing.T)

Source from the content-addressed store, hash-verified

102// Tests for GetCurrentCommitHash
103
104func 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
120func TestGetCurrentCommitHash_MatchesHEAD(t *testing.T) {
121 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 5

setupGitRepoFunction · 0.85
createFileFunction · 0.85
gitAddFunction · 0.85
gitCommitFunction · 0.85
GetCurrentCommitHashFunction · 0.85

Tested by

no test coverage detected