(t *testing.T)
| 360 | } |
| 361 | |
| 362 | func Test_createRun(t *testing.T) { |
| 363 | tests := []struct { |
| 364 | name string |
| 365 | opts CreateOptions |
| 366 | attach []string |
| 367 | host string |
| 368 | config string |
| 369 | httpStubs func(*testing.T, *httpmock.Registry) |
| 370 | promptStubs func(*testing.T, *prompter.PrompterMock) |
| 371 | wantsStdout string |
| 372 | wantsStderr string |
| 373 | wantsBrowse string |
| 374 | wantsErr string |
| 375 | }{ |
| 376 | { |
| 377 | name: "no args", |
| 378 | opts: CreateOptions{ |
| 379 | Detector: &fd.EnabledDetectorMock{}, |
| 380 | WebMode: true, |
| 381 | }, |
| 382 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new", |
| 383 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 384 | }, |
| 385 | { |
| 386 | name: "title and body", |
| 387 | opts: CreateOptions{ |
| 388 | Detector: &fd.EnabledDetectorMock{}, |
| 389 | WebMode: true, |
| 390 | Title: "myissue", |
| 391 | Body: "hello cli", |
| 392 | }, |
| 393 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?body=hello+cli&title=myissue", |
| 394 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 395 | }, |
| 396 | { |
| 397 | name: "assignee", |
| 398 | opts: CreateOptions{ |
| 399 | Detector: &fd.EnabledDetectorMock{}, |
| 400 | WebMode: true, |
| 401 | Assignees: []string{"monalisa"}, |
| 402 | }, |
| 403 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=monalisa&body=", |
| 404 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 405 | }, |
| 406 | { |
| 407 | name: "@me", |
| 408 | opts: CreateOptions{ |
| 409 | Detector: &fd.EnabledDetectorMock{}, |
| 410 | WebMode: true, |
| 411 | Assignees: []string{"@me"}, |
| 412 | }, |
| 413 | httpStubs: func(_ *testing.T, r *httpmock.Registry) { |
| 414 | r.Register( |
| 415 | httpmock.GraphQL(`query UserCurrent\b`), |
| 416 | httpmock.StringResponse(` |
| 417 | { "data": { |
| 418 | "viewer": { "login": "MonaLisa" } |
| 419 | } }`)) |
nothing calls this directly
no test coverage detected