MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestIsWorktree

Function TestIsWorktree

internal/git/worktree_test.go:226–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224}
225
226func 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
254func TestWorktreePathForPRD(t *testing.T) {
255 result := WorktreePathForPRD("/home/user/project", "auth")

Callers

nothing calls this directly

Calls 4

initTestRepoFunction · 0.85
CreateWorktreeFunction · 0.85
IsWorktreeFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected