(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func 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 | } |
nothing calls this directly
no test coverage detected