(t *testing.T)
| 311 | } |
| 312 | |
| 313 | func Test_createRun(t *testing.T) { |
| 314 | tests := []struct { |
| 315 | name string |
| 316 | opts CreateOptions |
| 317 | httpStubs func(*testing.T, *httpmock.Registry) |
| 318 | promptStubs func(*prompter.PrompterMock) |
| 319 | wantsStdout string |
| 320 | wantsStderr string |
| 321 | wantsBrowse string |
| 322 | wantsErr string |
| 323 | }{ |
| 324 | { |
| 325 | name: "no args", |
| 326 | opts: CreateOptions{ |
| 327 | Detector: &fd.EnabledDetectorMock{}, |
| 328 | WebMode: true, |
| 329 | }, |
| 330 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new", |
| 331 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 332 | }, |
| 333 | { |
| 334 | name: "title and body", |
| 335 | opts: CreateOptions{ |
| 336 | Detector: &fd.EnabledDetectorMock{}, |
| 337 | WebMode: true, |
| 338 | Title: "myissue", |
| 339 | Body: "hello cli", |
| 340 | }, |
| 341 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?body=hello+cli&title=myissue", |
| 342 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 343 | }, |
| 344 | { |
| 345 | name: "assignee", |
| 346 | opts: CreateOptions{ |
| 347 | Detector: &fd.EnabledDetectorMock{}, |
| 348 | WebMode: true, |
| 349 | Assignees: []string{"monalisa"}, |
| 350 | }, |
| 351 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=monalisa&body=", |
| 352 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 353 | }, |
| 354 | { |
| 355 | name: "@me", |
| 356 | opts: CreateOptions{ |
| 357 | Detector: &fd.EnabledDetectorMock{}, |
| 358 | WebMode: true, |
| 359 | Assignees: []string{"@me"}, |
| 360 | }, |
| 361 | httpStubs: func(_ *testing.T, r *httpmock.Registry) { |
| 362 | r.Register( |
| 363 | httpmock.GraphQL(`query UserCurrent\b`), |
| 364 | httpmock.StringResponse(` |
| 365 | { "data": { |
| 366 | "viewer": { "login": "MonaLisa" } |
| 367 | } }`)) |
| 368 | }, |
| 369 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=MonaLisa&body=", |
| 370 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
nothing calls this directly
no test coverage detected