(t *testing.T)
| 204 | } |
| 205 | |
| 206 | func Test_editRun(t *testing.T) { |
| 207 | tests := []struct { |
| 208 | name string |
| 209 | isTTY bool |
| 210 | opts EditOptions |
| 211 | httpStubs func(t *testing.T, reg *httpmock.Registry) |
| 212 | wantErr string |
| 213 | wantStdout string |
| 214 | wantStderr string |
| 215 | }{ |
| 216 | { |
| 217 | name: "edit the tag name", |
| 218 | isTTY: true, |
| 219 | opts: EditOptions{ |
| 220 | TagName: "v1.2.4", |
| 221 | }, |
| 222 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 223 | mockSuccessfulEditResponse(reg, func(params map[string]interface{}) { |
| 224 | assert.Equal(t, map[string]interface{}{ |
| 225 | "tag_name": "v1.2.4", |
| 226 | }, params) |
| 227 | }) |
| 228 | }, |
| 229 | wantStdout: "https://github.com/OWNER/REPO/releases/tag/v1.2.3\n", |
| 230 | wantStderr: "", |
| 231 | }, |
| 232 | { |
| 233 | name: "edit the target", |
| 234 | isTTY: true, |
| 235 | opts: EditOptions{ |
| 236 | Target: "c0ff33", |
| 237 | }, |
| 238 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 239 | mockSuccessfulEditResponse(reg, func(params map[string]interface{}) { |
| 240 | assert.Equal(t, map[string]interface{}{ |
| 241 | "tag_name": "v1.2.3", |
| 242 | "target_commitish": "c0ff33", |
| 243 | }, params) |
| 244 | }) |
| 245 | }, |
| 246 | wantStdout: "https://github.com/OWNER/REPO/releases/tag/v1.2.3\n", |
| 247 | wantStderr: "", |
| 248 | }, |
| 249 | { |
| 250 | name: "edit the release name", |
| 251 | isTTY: true, |
| 252 | opts: EditOptions{ |
| 253 | Name: stringPtr("Hot Release #1"), |
| 254 | }, |
| 255 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 256 | mockSuccessfulEditResponse(reg, func(params map[string]interface{}) { |
| 257 | assert.Equal(t, map[string]interface{}{ |
| 258 | "tag_name": "v1.2.3", |
| 259 | "name": "Hot Release #1", |
| 260 | }, params) |
| 261 | }) |
| 262 | }, |
| 263 | wantStdout: "https://github.com/OWNER/REPO/releases/tag/v1.2.3\n", |
nothing calls this directly
no test coverage detected