MCPcopy
hub / github.com/cli/cli / TestPRView_nontty_Comments

Function TestPRView_nontty_Comments

pkg/cmd/pr/view/view_test.go:767–876  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

765}
766
767func TestPRView_nontty_Comments(t *testing.T) {
768 tests := map[string]struct {
769 branch string
770 cli string
771 fixtures map[string]string
772 expectedOutputs []string
773 wantsErr bool
774 }{
775 "without comments flag": {
776 branch: "master",
777 cli: "123",
778 fixtures: map[string]string{
779 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
780 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
781 },
782 expectedOutputs: []string{
783 `title:\tsome title`,
784 `state:\tOPEN`,
785 `author:\tnobody`,
786 `url:\thttps://github.com/OWNER/REPO/pull/12`,
787 `some body`,
788 },
789 },
790 "with comments flag": {
791 branch: "master",
792 cli: "123 --comments",
793 fixtures: map[string]string{
794 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
795 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
796 "CommentsForPullRequest": "./fixtures/prViewPreviewFullComments.json",
797 },
798 expectedOutputs: []string{
799 `author:\tmonalisa`,
800 `association:\tnone`,
801 `edited:\ttrue`,
802 `status:\tnone`,
803 `Comment 1`,
804 `author:\tsam`,
805 `association:\tnone`,
806 `edited:\tfalse`,
807 `status:\tcommented`,
808 `Review 1`,
809 `author:\tjohnnytest`,
810 `association:\tcontributor`,
811 `edited:\tfalse`,
812 `status:\tnone`,
813 `Comment 2`,
814 `author:\tmatt`,
815 `association:\towner`,
816 `edited:\tfalse`,
817 `status:\tchanges requested`,
818 `Review 2`,
819 `author:\telvisp`,
820 `association:\tmember`,
821 `edited:\tfalse`,
822 `status:\tnone`,
823 `Comment 3`,
824 `author:\tleah`,

Callers

nothing calls this directly

Calls 11

VerifyMethod · 0.95
NewFunction · 0.92
ExpectLinesFunction · 0.92
prFromFixturesFunction · 0.85
EqualMethod · 0.80
StderrMethod · 0.80
runCommandFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected