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

Function TestGetCommitRangeLabel_Success

vcs/git/git_test.go:455–476  ·  view source on GitHub ↗

Tests for GetCommitRangeLabel

(t *testing.T)

Source from the content-addressed store, hash-verified

453// Tests for GetCommitRangeLabel
454
455func TestGetCommitRangeLabel_Success(t *testing.T) {
456 tmpDir := t.TempDir()
457 setupGitRepo(t, tmpDir)
458
459 createFile(t, tmpDir, "first.txt", "content")
460 gitAdd(t, tmpDir, "first.txt")
461 firstCommit := gitCommitAndGetSHA(t, tmpDir, "First commit")
462
463 createFile(t, tmpDir, "second.txt", "content")
464 gitAdd(t, tmpDir, "second.txt")
465 secondCommit := gitCommitAndGetSHA(t, tmpDir, "Second commit")
466
467 label, err := GetCommitRangeLabel(tmpDir, firstCommit, secondCommit)
468
469 require.NoError(t, err)
470 assert.Contains(t, label, "...")
471 // Should be in format "abc123...def456"
472 parts := strings.Split(label, "...")
473 assert.Len(t, parts, 2)
474 assert.True(t, len(parts[0]) >= 7)
475 assert.True(t, len(parts[1]) >= 7)
476}
477
478func TestGetCommitRangeLabel_WithHEAD(t *testing.T) {
479 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 5

setupGitRepoFunction · 0.85
createFileFunction · 0.85
gitAddFunction · 0.85
gitCommitAndGetSHAFunction · 0.85
GetCommitRangeLabelFunction · 0.85

Tested by

no test coverage detected