(t *testing.T)
| 388 | } |
| 389 | |
| 390 | func Test_createRun(t *testing.T) { |
| 391 | tests := []struct { |
| 392 | name string |
| 393 | opts CreateOptions |
| 394 | attach []string |
| 395 | host string |
| 396 | config string |
| 397 | httpStubs func(*testing.T, *httpmock.Registry) |
| 398 | promptStubs func(*testing.T, *prompter.PrompterMock) |
| 399 | wantsStdout string |
| 400 | wantsStderr string |
| 401 | wantsBrowse string |
| 402 | wantsErr string |
| 403 | wantOperations *attachments.UploadResult |
| 404 | }{ |
| 405 | { |
| 406 | name: "no args", |
| 407 | opts: CreateOptions{ |
| 408 | Detector: &fd.EnabledDetectorMock{}, |
| 409 | WebMode: true, |
| 410 | }, |
| 411 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new", |
| 412 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 413 | }, |
| 414 | { |
| 415 | name: "title and body", |
| 416 | opts: CreateOptions{ |
| 417 | Detector: &fd.EnabledDetectorMock{}, |
| 418 | WebMode: true, |
| 419 | Title: "myissue", |
| 420 | Body: "hello cli", |
| 421 | }, |
| 422 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?body=hello+cli&title=myissue", |
| 423 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 424 | }, |
| 425 | { |
| 426 | name: "assignee", |
| 427 | opts: CreateOptions{ |
| 428 | Detector: &fd.EnabledDetectorMock{}, |
| 429 | WebMode: true, |
| 430 | Assignees: []string{"monalisa"}, |
| 431 | }, |
| 432 | wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=monalisa&body=", |
| 433 | wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n", |
| 434 | }, |
| 435 | { |
| 436 | name: "@me", |
| 437 | opts: CreateOptions{ |
| 438 | Detector: &fd.EnabledDetectorMock{}, |
| 439 | WebMode: true, |
| 440 | Assignees: []string{"@me"}, |
| 441 | }, |
| 442 | httpStubs: func(_ *testing.T, r *httpmock.Registry) { |
| 443 | r.Register( |
| 444 | httpmock.GraphQL(`query UserCurrent\b`), |
| 445 | httpmock.StringResponse(` |
| 446 | { "data": { |
| 447 | "viewer": { "login": "MonaLisa" } |
nothing calls this directly
no test coverage detected