(t *testing.T)
| 458 | } |
| 459 | |
| 460 | func TestIssueView_nontty_Comments(t *testing.T) { |
| 461 | tests := map[string]struct { |
| 462 | cli string |
| 463 | httpStubs func(*httpmock.Registry) |
| 464 | expectedOutputs []string |
| 465 | wantsErr bool |
| 466 | }{ |
| 467 | "without comments flag": { |
| 468 | cli: "123", |
| 469 | httpStubs: func(r *httpmock.Registry) { |
| 470 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewSingleComment.json")) |
| 471 | mockEmptyV2ProjectItems(t, r) |
| 472 | }, |
| 473 | expectedOutputs: []string{ |
| 474 | `title:\tsome title`, |
| 475 | `state:\tOPEN`, |
| 476 | `author:\tmarseilles`, |
| 477 | `comments:\t6`, |
| 478 | `number:\t123`, |
| 479 | `some body`, |
| 480 | }, |
| 481 | }, |
| 482 | "with comments flag": { |
| 483 | cli: "123 --comments", |
| 484 | httpStubs: func(r *httpmock.Registry) { |
| 485 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewSingleComment.json")) |
| 486 | r.Register(httpmock.GraphQL(`query CommentsForIssue\b`), httpmock.FileResponse("./fixtures/issueView_previewFullComments.json")) |
| 487 | mockEmptyV2ProjectItems(t, r) |
| 488 | }, |
| 489 | expectedOutputs: []string{ |
| 490 | `author:\tmonalisa`, |
| 491 | `association:\t`, |
| 492 | `edited:\ttrue`, |
| 493 | `Comment 1`, |
| 494 | `author:\tjohnnytest`, |
| 495 | `association:\tcontributor`, |
| 496 | `edited:\tfalse`, |
| 497 | `Comment 2`, |
| 498 | `author:\telvisp`, |
| 499 | `association:\tmember`, |
| 500 | `edited:\tfalse`, |
| 501 | `Comment 3`, |
| 502 | `author:\tloislane`, |
| 503 | `association:\towner`, |
| 504 | `edited:\tfalse`, |
| 505 | `Comment 4`, |
| 506 | `author:\tmarseilles`, |
| 507 | `association:\tcollaborator`, |
| 508 | `edited:\tfalse`, |
| 509 | `Comment 5`, |
| 510 | }, |
| 511 | }, |
| 512 | "with invalid comments flag": { |
| 513 | cli: "123 --comments 3", |
| 514 | wantsErr: true, |
| 515 | }, |
| 516 | } |
| 517 | for name, tc := range tests { |
nothing calls this directly
no test coverage detected