(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func Test_deleteRun(t *testing.T) { |
| 112 | tests := []struct { |
| 113 | name string |
| 114 | isTTY bool |
| 115 | opts DeleteOptions |
| 116 | prompterStubs func(*prompter.PrompterMock) |
| 117 | runStubs func(*run.CommandStubber) |
| 118 | wantErr string |
| 119 | wantStdout string |
| 120 | wantStderr string |
| 121 | }{ |
| 122 | { |
| 123 | name: "interactive confirm", |
| 124 | isTTY: true, |
| 125 | opts: DeleteOptions{ |
| 126 | TagName: "v1.2.3", |
| 127 | }, |
| 128 | wantStdout: "", |
| 129 | wantStderr: "✓ Deleted release v1.2.3\n! Note that the v1.2.3 git tag still remains in the repository\n", |
| 130 | prompterStubs: func(pm *prompter.PrompterMock) { |
| 131 | pm.ConfirmFunc = func(p string, d bool) (bool, error) { |
| 132 | if p == "Delete release v1.2.3 in OWNER/REPO?" { |
| 133 | return true, nil |
| 134 | } |
| 135 | return false, prompter.NoSuchPromptErr(p) |
| 136 | } |
| 137 | }, |
| 138 | }, |
| 139 | { |
| 140 | name: "skipping confirmation", |
| 141 | isTTY: true, |
| 142 | opts: DeleteOptions{ |
| 143 | TagName: "v1.2.3", |
| 144 | SkipConfirm: true, |
| 145 | CleanupTag: false, |
| 146 | }, |
| 147 | wantStdout: ``, |
| 148 | wantStderr: heredoc.Doc(` |
| 149 | ✓ Deleted release v1.2.3 |
| 150 | ! Note that the v1.2.3 git tag still remains in the repository |
| 151 | `), |
| 152 | }, |
| 153 | { |
| 154 | name: "non-interactive", |
| 155 | isTTY: false, |
| 156 | opts: DeleteOptions{ |
| 157 | TagName: "v1.2.3", |
| 158 | SkipConfirm: false, |
| 159 | CleanupTag: false, |
| 160 | }, |
| 161 | wantStdout: ``, |
| 162 | wantStderr: ``, |
| 163 | }, |
| 164 | { |
| 165 | name: "cleanup-tag & skipping confirmation", |
| 166 | isTTY: true, |
| 167 | opts: DeleteOptions{ |
| 168 | TagName: "v1.2.3", |
nothing calls this directly
no test coverage detected