MCPcopy Create free account
hub / github.com/github/gh-aw / TestInitRepositoryVerbose

Function TestInitRepositoryVerbose

pkg/cli/init_command_test.go:584–618  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

582}
583
584func TestInitRepositoryVerbose(t *testing.T) {
585 tmpDir := testutil.TempDir(t, "test-*")
586
587 originalDir, err := os.Getwd()
588 if err != nil {
589 t.Fatalf("Failed to get current directory: %v", err)
590 }
591 defer func() {
592 _ = os.Chdir(originalDir)
593 }()
594
595 if err := os.Chdir(tmpDir); err != nil {
596 t.Fatalf("Failed to change to temp directory: %v", err)
597 }
598
599 // Initialize git repo
600 if err := exec.Command("git", "init").Run(); err != nil {
601 t.Skip("Git not available")
602 }
603
604 // Configure git
605 exec.Command("git", "config", "user.name", "Test User").Run()
606 exec.Command("git", "config", "user.email", "test@example.com").Run()
607
608 // Test verbose mode with MCP enabled by default (should not error, just produce more output)
609 err = InitRepository(InitOptions{Verbose: true, Skill: true, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil})
610 if err != nil {
611 t.Fatalf("InitRepository(, false, false, false, nil) in verbose mode failed: %v", err)
612 }
613
614 // Verify basic files were still created
615 if _, err := os.Stat(".gitattributes"); os.IsNotExist(err) {
616 t.Error("Expected .gitattributes to be created even in verbose mode")
617 }
618}
619
620func TestInitRepositoryNotInGitRepo(t *testing.T) {
621 tmpDir := testutil.TempDir(t, "test-*")

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
InitRepositoryFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected