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

Function TestInitCmd_CommandStructure

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

Source from the content-addressed store, hash-verified

13)
14
15func TestInitCmd_CommandStructure(t *testing.T) {
16 // Cleanup.
17 dirs.RemoveAllForTest()
18
19 initCmd := initCmd{}
20 celer := configs.NewCeler()
21 cmd := initCmd.Command(celer)
22
23 // Test command basic properties.
24 if cmd.Use != "init" {
25 t.Errorf("Expected Use to be 'init', got '%s'", cmd.Use)
26 }
27
28 if cmd.Short == "" {
29 t.Error("Short description should not be empty")
30 }
31
32 // Test flags.
33 urlFlag := cmd.Flags().Lookup("url")
34 if urlFlag == nil {
35 t.Error("--url flag should be defined")
36 } else {
37 if urlFlag.Shorthand != "u" {
38 t.Errorf("Expected url flag shorthand to be 'u', got '%s'", urlFlag.Shorthand)
39 }
40 }
41
42 branchFlag := cmd.Flags().Lookup("branch")
43 if branchFlag == nil {
44 t.Error("--branch flag should be defined")
45 } else {
46 if branchFlag.Shorthand != "b" {
47 t.Errorf("Expected branch flag shorthand to be 'b', got '%s'", branchFlag.Shorthand)
48 }
49 }
50}
51
52func TestInitCmd_Completion(t *testing.T) {
53 // 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