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

Function TestProjectNewCommandArgs

pkg/cli/project_command_test.go:131–166  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func TestProjectNewCommandArgs(t *testing.T) {
132 cmd := NewProjectNewCommand()
133
134 tests := []struct {
135 name string
136 args []string
137 shouldErr bool
138 }{
139 {
140 name: "no arguments",
141 args: []string{},
142 shouldErr: true,
143 },
144 {
145 name: "one argument",
146 args: []string{"My Project"},
147 shouldErr: false,
148 },
149 {
150 name: "too many arguments",
151 args: []string{"My Project", "Extra"},
152 shouldErr: true,
153 },
154 }
155
156 for _, tt := range tests {
157 t.Run(tt.name, func(t *testing.T) {
158 err := cmd.Args(cmd, tt.args)
159 if tt.shouldErr {
160 assert.Error(t, err, "Should return error for invalid arguments")
161 } else {
162 assert.NoError(t, err, "Should not return error for valid arguments")
163 }
164 })
165 }
166}
167
168func TestProjectNewCommandFlags(t *testing.T) {
169 cmd := NewProjectNewCommand()

Callers

nothing calls this directly

Calls 3

NewProjectNewCommandFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected