(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestIsWorktree(t *testing.T) { |
| 227 | t.Run("returns true for valid worktree", func(t *testing.T) { |
| 228 | dir := initTestRepo(t) |
| 229 | wtPath := filepath.Join(dir, "worktrees", "test-prd") |
| 230 | |
| 231 | if err := CreateWorktree(dir, wtPath, "chief/test-prd"); err != nil { |
| 232 | t.Fatalf("CreateWorktree() error = %v", err) |
| 233 | } |
| 234 | |
| 235 | if !IsWorktree(wtPath) { |
| 236 | t.Error("IsWorktree() = false, want true") |
| 237 | } |
| 238 | }) |
| 239 | |
| 240 | t.Run("returns false for non-existent path", func(t *testing.T) { |
| 241 | if IsWorktree("/nonexistent/path") { |
| 242 | t.Error("IsWorktree() = true for non-existent path") |
| 243 | } |
| 244 | }) |
| 245 | |
| 246 | t.Run("returns false for plain directory", func(t *testing.T) { |
| 247 | dir := t.TempDir() |
| 248 | if IsWorktree(dir) { |
| 249 | t.Error("IsWorktree() = true for plain directory") |
| 250 | } |
| 251 | }) |
| 252 | } |
| 253 | |
| 254 | func TestWorktreePathForPRD(t *testing.T) { |
| 255 | result := WorktreePathForPRD("/home/user/project", "auth") |
nothing calls this directly
no test coverage detected