MCPcopy Create free account
hub / github.com/devopsctl/gitlabctl / TestDescBranchCmd

Function TestDescBranchCmd

cmd/desc_branch_test.go:27–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestDescBranchCmd(t *testing.T) {
28 tt := []struct {
29 name string
30 flagsMap map[string]string
31 args []string
32 expect testResult
33 }{
34 {
35 name: "describe project master branch",
36 flagsMap: map[string]string{
37 "project": "Group2/project12",
38 },
39 args: []string{"master"},
40 expect: pass,
41 },
42 {
43 name: "describing a non existent branch fails",
44 flagsMap: map[string]string{
45 "project": "4",
46 },
47 args: []string{"release-99"},
48 expect: fail,
49 },
50 }
51
52 for _, tc := range tt {
53 t.Run(tc.name, func(t *testing.T) {
54 execT := execTestCmdFlags{
55 t: t,
56 cmd: descBranchCmd,
57 flagsMap: tc.flagsMap,
58 args: tc.args,
59 }
60 stdout, execResult := execT.executeCommand()
61 assertEqualResult(t, execResult, tc.expect, printFlagsTable(tc.flagsMap, stdout))
62 if tc.expect == pass {
63 assertOutContains(t, stdout, tc.args[0])
64 }
65 })
66 }
67
68}

Callers

nothing calls this directly

Calls 4

executeCommandMethod · 0.95
assertEqualResultFunction · 0.85
printFlagsTableFunction · 0.85
assertOutContainsFunction · 0.85

Tested by

no test coverage detected