MCPcopy Create free account
hub / github.com/cli/cli / TestPRView_nontty_Comments

Function TestPRView_nontty_Comments

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

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected