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

Function TestCreateCmd_CommandStructure

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

Source from the content-addressed store, hash-verified

15)
16
17func TestCreateCmd_CommandStructure(t *testing.T) {
18 // Cleanup.
19 dirs.RemoveAllForTest()
20
21 celer := configs.NewCeler()
22 createCmd := createCmd{}
23 cmd := createCmd.Command(celer)
24
25 t.Run("command_structure", func(t *testing.T) {
26 if cmd.Use != "create" {
27 t.Errorf("Expected Use to be 'create', got '%s'", cmd.Use)
28 }
29
30 if cmd.Short == "" {
31 t.Error("Short description should not be empty")
32 }
33
34 if cmd.Long == "" {
35 t.Error("Long description should not be empty")
36 }
37
38 // Check flags exist
39 flags := []string{"platform", "project", "port"}
40 for _, flagName := range flags {
41 if cmd.Flags().Lookup(flagName) == nil {
42 t.Errorf("--%s flag should be defined", flagName)
43 }
44 }
45 })
46
47 t.Run("mutually_exclusive_flags", func(t *testing.T) {
48 // This test verifies that the flags are properly marked as mutually exclusive,
49 // The actual enforcement is handled by Cobra during command execution.
50 flagNames := []string{"platform", "project", "port"}
51 for _, flagName := range flagNames {
52 if cmd.Flags().Lookup(flagName) == nil {
53 t.Errorf("Flag %s should exist", flagName)
54 }
55 }
56 })
57}
58
59func TestCreateCmd_Completion(t *testing.T) {
60 // Cleanup.

Callers

nothing calls this directly

Calls 4

CommandMethod · 0.95
RemoveAllForTestFunction · 0.92
NewCelerFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected