Tests for GetCommitRangeLabel
(t *testing.T)
| 453 | // Tests for GetCommitRangeLabel |
| 454 | |
| 455 | func 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 | |
| 478 | func TestGetCommitRangeLabel_WithHEAD(t *testing.T) { |
| 479 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected