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

Function TestNewInitCommand

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

Source from the content-addressed store, hash-verified

13)
14
15func TestNewInitCommand(t *testing.T) {
16 t.Parallel()
17
18 cmd := NewInitCommand()
19
20 if cmd == nil {
21 t.Fatal("NewInitCommand() returned nil")
22 }
23
24 if cmd.Use != "init" {
25 t.Errorf("Expected Use to be 'init', got %q", cmd.Use)
26 }
27
28 if cmd.Short == "" {
29 t.Error("Expected Short description to be set")
30 }
31
32 if cmd.Long == "" {
33 t.Error("Expected Long description to be set")
34 }
35
36 // Verify flags
37 noMcpFlag := cmd.Flags().Lookup("no-mcp")
38 if noMcpFlag == nil {
39 t.Error("Expected 'no-mcp' flag to be defined")
40 return
41 }
42
43 noSkillFlag := cmd.Flags().Lookup("no-skill")
44 if noSkillFlag == nil {
45 t.Error("Expected 'no-skill' flag to be defined")
46 return
47 }
48
49 noAgentFlag := cmd.Flags().Lookup("no-agent")
50 if noAgentFlag == nil {
51 t.Error("Expected 'no-agent' flag to be defined")
52 return
53 }
54
55 // Verify hidden --mcp flag still exists for backward compatibility
56 mcpFlag := cmd.Flags().Lookup("mcp")
57 if mcpFlag == nil {
58 t.Error("Expected 'mcp' flag to be defined (for backward compatibility)")
59 return
60 }
61
62 engineFlag := cmd.Flags().Lookup("engine")
63 if engineFlag == nil {
64 t.Error("Expected 'engine' flag to be defined")
65 return
66 }
67 if engineFlag.Hidden {
68 t.Error("Expected 'engine' flag to be visible")
69 }
70
71 // Verify --mcp flag is hidden
72 if !mcpFlag.Hidden {

Callers

nothing calls this directly

Calls 3

NewInitCommandFunction · 0.85
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected