(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func 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 | |
| 57 | func TestTreeCmd_ValidateTarget(t *testing.T) { |
| 58 | // Cleanup. |
nothing calls this directly
no test coverage detected