| 809 | } |
| 810 | |
| 811 | func TestCanCleanOrphanedWorktree(t *testing.T) { |
| 812 | p := &PRDPicker{ |
| 813 | basePath: "/project", |
| 814 | entries: []PRDEntry{ |
| 815 | { |
| 816 | Name: "auth", |
| 817 | WorktreeDir: "/project/.chief/worktrees/auth", |
| 818 | Orphaned: true, |
| 819 | LoopState: loop.LoopStateReady, |
| 820 | }, |
| 821 | }, |
| 822 | selectedIndex: 0, |
| 823 | } |
| 824 | if !p.CanClean() { |
| 825 | t.Error("expected CanClean() to return true for orphaned worktree") |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | func TestOrphanedWorktreeNotTracked(t *testing.T) { |
| 830 | // An orphaned entry with no PRD loaded should still be cleanable |