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

Function TestCleanCmd_CommandStructure

cmds/cmd_clean_test.go:21–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestCleanCmd_CommandStructure(t *testing.T) {
22 // Cleanup.
23 dirs.RemoveAllForTest()
24
25 cleanCmd := cleanCmd{}
26 celer := configs.NewCeler()
27 cmd := cleanCmd.Command(celer)
28
29 // Test command basic properties.
30 if cmd.Use != "clean" {
31 t.Errorf("Expected Use to be 'clean', got '%s'", cmd.Use)
32 }
33
34 if cmd.Short == "" {
35 t.Error("Short description should not be empty")
36 }
37
38 if cmd.Long == "" {
39 t.Error("Long description should not be empty")
40 }
41
42 // Test flags.
43 recursiveFlag := cmd.Flags().Lookup("recursive")
44 if recursiveFlag == nil {
45 t.Error("--recursive flag should be defined")
46 } else {
47 if recursiveFlag.Shorthand != "r" {
48 t.Errorf("Expected recursive flag shorthand to be 'r', got '%s'", recursiveFlag.Shorthand)
49 }
50 }
51
52 devFlag := cmd.Flags().Lookup("dev")
53 if devFlag == nil {
54 t.Error("--dev flag should be defined")
55 } else {
56 if devFlag.Shorthand != "d" {
57 t.Errorf("Expected dev flag shorthand to be 'd', got '%s'", devFlag.Shorthand)
58 }
59 }
60
61 allFlag := cmd.Flags().Lookup("all")
62 if allFlag == nil {
63 t.Error("--all flag should be defined")
64 } else {
65 if allFlag.Shorthand != "a" {
66 t.Errorf("Expected all flag shorthand to be 'a', got '%s'", allFlag.Shorthand)
67 }
68 }
69}
70
71func TestCleanCmd_ArgsValidation(t *testing.T) {
72 // 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