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

Function TestRemoveCmd_CommandStructure

cmds/cmd_remove_test.go:19–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestRemoveCmd_CommandStructure(t *testing.T) {
20 // Cleanup.
21 dirs.RemoveAllForTest()
22
23 // Test command creation
24 remove := &removeCmd{}
25 celer := &configs.Celer{}
26
27 cmd := remove.Command(celer)
28 if cmd.Use != "remove" {
29 t.Errorf("Expected Use to be 'remove', got %s", cmd.Use)
30 }
31
32 if cmd.Short == "" {
33 t.Error("Short description should not be empty")
34 }
35
36 if cmd.Long == "" {
37 t.Error("Long description should not be empty")
38 }
39
40 // Test flags.
41 tests := []struct {
42 flagName string
43 shorthand string
44 defaultValue string
45 }{
46 {"build-cache", "c", "false"},
47 {"recursive", "r", "false"},
48 {"purge", "p", "false"},
49 {"dev", "d", "false"},
50 }
51
52 for _, test := range tests {
53 t.Run(test.flagName, func(t *testing.T) {
54 flag := cmd.Flags().Lookup(test.flagName)
55 if flag == nil {
56 t.Errorf("Flag --%s should be defined", test.flagName)
57 return
58 }
59
60 if flag.Shorthand != test.shorthand {
61 t.Errorf("Expected shorthand %s, got %s", test.shorthand, flag.Shorthand)
62 }
63
64 if flag.DefValue != test.defaultValue {
65 t.Errorf("Expected default value %s, got %s", test.defaultValue, flag.DefValue)
66 }
67 })
68 }
69
70 // Test minimum args requirement
71 if cmd.Args == nil {
72 t.Error("Args validation should be set")
73 }
74}
75
76func TestRemoveCmd_Completion(t *testing.T) {

Callers

nothing calls this directly

Calls 3

CommandMethod · 0.95
RemoveAllForTestFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected