MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestCreateCmd_CommandExecutionValidation

Function TestCreateCmd_CommandExecutionValidation

cmds/cmd_create_test.go:213–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestCreateCmd_CommandExecutionValidation(t *testing.T) {
214 t.Run("empty project value should fail", func(t *testing.T) {
215 celer := newInitializedCeler(t)
216 cmd := &createCmd{}
217
218 stderr, err := runCommand(t, cmd.Command(celer), "--project=")
219 if err == nil {
220 t.Fatal("expected error when --project is set with empty value")
221 }
222 if !strings.Contains(stderr, "cannot be empty") {
223 t.Fatalf("stderr should report empty value, got:\n%s", stderr)
224 }
225 })
226
227 t.Run("positional args should fail", func(t *testing.T) {
228 celer := newInitializedCeler(t)
229 cmd := &createCmd{}
230
231 // cobra.NoArgs handles this — error comes from cobra, not from RunE.
232 _, err := runCommand(t, cmd.Command(celer), "unexpected-arg", "--project=test_project")
233 if err == nil {
234 t.Fatal("expected error when positional args are provided")
235 }
236 })
237}
238
239func TestCreateCmd(t *testing.T) {
240 celer := newInitializedCeler(t)

Callers

nothing calls this directly

Calls 3

CommandMethod · 0.95
newInitializedCelerFunction · 0.85
runCommandFunction · 0.85

Tested by

no test coverage detected