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