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

Function TestTreeCmd_CommandStructure

cmds/cmd_tree_test.go:15–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestTreeCmd_CommandStructure(t *testing.T) {
16 // Cleanup.
17 dirs.RemoveAllForTest()
18
19 treeCmd := treeCmd{}
20 celer := configs.NewCeler()
21 cmd := treeCmd.Command(celer)
22
23 // Test command basic properties.
24 if cmd.Use != "tree" {
25 t.Errorf("Expected Use to be 'tree', got '%s'", cmd.Use)
26 }
27
28 if cmd.Short == "" {
29 t.Error("Short description should not be empty")
30 }
31
32 if cmd.Long == "" {
33 t.Error("Long description should not be empty")
34 }
35
36 // Verify Long description contains examples
37 if !strings.Contains(cmd.Long, "Examples:") {
38 t.Error("Long description should contain examples")
39 }
40
41 // Test that command requires exactly 1 argument
42 if cmd.Args == nil {
43 t.Error("Args validation should be set")
44 }
45
46 // Test flags.
47 hideDevFlag := cmd.Flags().Lookup("hide-dev")
48 if hideDevFlag == nil {
49 t.Error("--hide-dev flag should be defined")
50 } else {
51 if hideDevFlag.DefValue != "false" {
52 t.Errorf("Expected hide-dev default to be 'false', got '%s'", hideDevFlag.DefValue)
53 }
54 }
55}
56
57func TestTreeCmd_ValidateTarget(t *testing.T) {
58 // 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