TestInitRepository_WithRootCmd verifies that InitRepository works with a real rootCmd
(t *testing.T)
| 73 | |
| 74 | // TestInitRepository_WithRootCmd verifies that InitRepository works with a real rootCmd |
| 75 | func TestInitRepository_WithRootCmd(t *testing.T) { |
| 76 | // Create a temporary git repository |
| 77 | tempDir := testutil.TempDir(t, "test-*") |
| 78 | |
| 79 | // Change to the temp directory |
| 80 | oldWd, err := os.Getwd() |
| 81 | require.NoError(t, err, "Failed to get current directory") |
| 82 | defer func() { |
| 83 | _ = os.Chdir(oldWd) |
| 84 | }() |
| 85 | err = os.Chdir(tempDir) |
| 86 | require.NoError(t, err, "Failed to change directory") |
| 87 | |
| 88 | // Initialize git repo |
| 89 | err = exec.Command("git", "init").Run() |
| 90 | require.NoError(t, err, "Failed to init git repo") |
| 91 | |
| 92 | // Create a cobra command to use as rootCmd |
| 93 | rootCmd := &cobra.Command{ |
| 94 | Use: "gh-aw", |
| 95 | Short: "GitHub Agentic Workflows", |
| 96 | } |
| 97 | |
| 98 | // InitRepository with real rootCmd should succeed |
| 99 | err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: true, MCP: false, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: rootCmd}) |
| 100 | require.NoError(t, err, "InitRepository with rootCmd should succeed") |
| 101 | } |
| 102 | |
| 103 | // TestInstallShellCompletion_TypeAssertion verifies type assertion behavior |
| 104 | func TestInstallShellCompletion_TypeAssertion(t *testing.T) { |
nothing calls this directly
no test coverage detected