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