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

Function TestManagerRegisterWithWorktree

internal/loop/manager_test.go:377–410  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

375}
376
377func TestManagerRegisterWithWorktree(t *testing.T) {
378 tmpDir := t.TempDir()
379 prdPath := createTestPRDWithName(t, tmpDir, "test-prd")
380
381 m := NewManager(10, testProvider)
382
383 err := m.RegisterWithWorktree("test-prd", prdPath, "/tmp/worktree/test-prd", "chief/test-prd")
384 if err != nil {
385 t.Fatalf("unexpected error: %v", err)
386 }
387
388 instance := m.GetInstance("test-prd")
389 if instance == nil {
390 t.Fatal("expected instance to be registered")
391 }
392 if instance.Name != "test-prd" {
393 t.Errorf("expected name 'test-prd', got '%s'", instance.Name)
394 }
395 if instance.WorktreeDir != "/tmp/worktree/test-prd" {
396 t.Errorf("expected WorktreeDir '/tmp/worktree/test-prd', got '%s'", instance.WorktreeDir)
397 }
398 if instance.Branch != "chief/test-prd" {
399 t.Errorf("expected Branch 'chief/test-prd', got '%s'", instance.Branch)
400 }
401 if instance.State != LoopStateReady {
402 t.Errorf("expected state Ready, got %v", instance.State)
403 }
404
405 // Duplicate registration should fail
406 err = m.RegisterWithWorktree("test-prd", prdPath, "/tmp/worktree/test-prd", "chief/test-prd")
407 if err == nil {
408 t.Error("expected error when registering duplicate PRD")
409 }
410}
411
412func TestManagerRegisterWithWorktreeFieldsInGetAllInstances(t *testing.T) {
413 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

RegisterWithWorktreeMethod · 0.95
GetInstanceMethod · 0.95
createTestPRDWithNameFunction · 0.85
NewManagerFunction · 0.85

Tested by

no test coverage detected