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