(t *testing.T)
| 775 | } |
| 776 | |
| 777 | func TestPRView_tty_Comments(t *testing.T) { |
| 778 | tests := map[string]struct { |
| 779 | branch string |
| 780 | cli string |
| 781 | fixtures map[string]string |
| 782 | expectedOutputs []string |
| 783 | wantsErr bool |
| 784 | }{ |
| 785 | "without comments flag": { |
| 786 | branch: "master", |
| 787 | cli: "123", |
| 788 | fixtures: map[string]string{ |
| 789 | "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json", |
| 790 | "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json", |
| 791 | }, |
| 792 | expectedOutputs: []string{ |
| 793 | `some title OWNER/REPO#12`, |
| 794 | `1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f}`, |
| 795 | `some body`, |
| 796 | `———————— Not showing 9 comments ————————`, |
| 797 | `marseilles \(Collaborator\) • Jan 9, 2020 • Newest comment`, |
| 798 | `4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680}`, |
| 799 | `Comment 5`, |
| 800 | `Use --comments to view the full conversation`, |
| 801 | `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`, |
| 802 | }, |
| 803 | }, |
| 804 | "with comments flag": { |
| 805 | branch: "master", |
| 806 | cli: "123 --comments", |
| 807 | fixtures: map[string]string{ |
| 808 | "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json", |
| 809 | "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json", |
| 810 | "CommentsForPullRequest": "./fixtures/prViewPreviewFullComments.json", |
| 811 | }, |
| 812 | expectedOutputs: []string{ |
| 813 | `some title OWNER/REPO#12`, |
| 814 | `some body`, |
| 815 | `monalisa • Jan 1, 2020 • Edited`, |
| 816 | `1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f} • 4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680} • 7 \x{1f44e} • 8 \x{1f44d}`, |
| 817 | `Comment 1`, |
| 818 | `sam commented • Jan 2, 2020`, |
| 819 | `1 \x{1f44e} • 1 \x{1f44d}`, |
| 820 | `Review 1`, |
| 821 | `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-1`, |
| 822 | `johnnytest \(Contributor\) • Jan 3, 2020`, |
| 823 | `Comment 2`, |
| 824 | `matt requested changes \(Owner\) • Jan 4, 2020`, |
| 825 | `1 \x{1f615} • 1 \x{1f440}`, |
| 826 | `Review 2`, |
| 827 | `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-2`, |
| 828 | `elvisp \(Member\) • Jan 5, 2020`, |
| 829 | `Comment 3`, |
| 830 | `leah approved \(Member\) • Jan 6, 2020 • Edited`, |
| 831 | `Review 3`, |
| 832 | `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-3`, |
| 833 | `loislane \(Owner\) • Jan 7, 2020`, |
| 834 | `Comment 4`, |
nothing calls this directly
no test coverage detected