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

Function TestInitRepository_WithRootCmd

pkg/cli/interfaces_test.go:75–101  ·  view source on GitHub ↗

TestInitRepository_WithRootCmd verifies that InitRepository works with a real rootCmd

(t *testing.T)

Source from the content-addressed store, hash-verified

73
74// TestInitRepository_WithRootCmd verifies that InitRepository works with a real rootCmd
75func 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
104func TestInstallShellCompletion_TypeAssertion(t *testing.T) {

Callers

nothing calls this directly

Calls 3

TempDirFunction · 0.92
InitRepositoryFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected