(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestDeleteBranch(t *testing.T) { |
| 32 | t.Run("deletes existing branch", func(t *testing.T) { |
| 33 | dir := initTestRepo(t) |
| 34 | |
| 35 | // Create a branch |
| 36 | cmd := exec.Command("git", "branch", "feature-branch") |
| 37 | cmd.Dir = dir |
| 38 | if out, err := cmd.CombinedOutput(); err != nil { |
| 39 | t.Fatalf("git branch failed: %s", string(out)) |
| 40 | } |
| 41 | |
| 42 | // Verify it exists |
| 43 | exists, err := BranchExists(dir, "feature-branch") |
| 44 | if err != nil { |
| 45 | t.Fatalf("BranchExists() error = %v", err) |
| 46 | } |
| 47 | if !exists { |
| 48 | t.Fatal("branch should exist before deletion") |
| 49 | } |
| 50 | |
| 51 | // Delete the branch |
| 52 | err = DeleteBranch(dir, "feature-branch") |
| 53 | if err != nil { |
| 54 | t.Fatalf("DeleteBranch() error = %v", err) |
| 55 | } |
| 56 | |
| 57 | // Verify it's gone |
| 58 | exists, err = BranchExists(dir, "feature-branch") |
| 59 | if err != nil { |
| 60 | t.Fatalf("BranchExists() error = %v", err) |
| 61 | } |
| 62 | if exists { |
| 63 | t.Error("branch still exists after deletion") |
| 64 | } |
| 65 | }) |
| 66 | |
| 67 | t.Run("fails for non-existent branch", func(t *testing.T) { |
| 68 | dir := initTestRepo(t) |
| 69 | err := DeleteBranch(dir, "nonexistent-branch") |
| 70 | if err == nil { |
| 71 | t.Error("DeleteBranch() expected error for non-existent branch, got nil") |
| 72 | } |
| 73 | }) |
| 74 | } |
| 75 | |
| 76 | func TestPRTitleFromPRD(t *testing.T) { |
| 77 | p := &prd.PRD{ |
nothing calls this directly
no test coverage detected