MCPcopy
hub / github.com/cli/cli / TestPRView_tty_Comments

Function TestPRView_tty_Comments

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

Source from the content-addressed store, hash-verified

666}
667
668func TestPRView_tty_Comments(t *testing.T) {
669 tests := map[string]struct {
670 branch string
671 cli string
672 fixtures map[string]string
673 expectedOutputs []string
674 wantsErr bool
675 }{
676 "without comments flag": {
677 branch: "master",
678 cli: "123",
679 fixtures: map[string]string{
680 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
681 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
682 },
683 expectedOutputs: []string{
684 `some title OWNER/REPO#12`,
685 `1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f}`,
686 `some body`,
687 `———————— Not showing 9 comments ————————`,
688 `marseilles \(Collaborator\) • Jan 9, 2020 • Newest comment`,
689 `4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680}`,
690 `Comment 5`,
691 `Use --comments to view the full conversation`,
692 `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
693 },
694 },
695 "with comments flag": {
696 branch: "master",
697 cli: "123 --comments",
698 fixtures: map[string]string{
699 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
700 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
701 "CommentsForPullRequest": "./fixtures/prViewPreviewFullComments.json",
702 },
703 expectedOutputs: []string{
704 `some title OWNER/REPO#12`,
705 `some body`,
706 `monalisa • Jan 1, 2020 • Edited`,
707 `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}`,
708 `Comment 1`,
709 `sam commented • Jan 2, 2020`,
710 `1 \x{1f44e} • 1 \x{1f44d}`,
711 `Review 1`,
712 `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-1`,
713 `johnnytest \(Contributor\) • Jan 3, 2020`,
714 `Comment 2`,
715 `matt requested changes \(Owner\) • Jan 4, 2020`,
716 `1 \x{1f615} • 1 \x{1f440}`,
717 `Review 2`,
718 `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-2`,
719 `elvisp \(Member\) • Jan 5, 2020`,
720 `Comment 3`,
721 `leah approved \(Member\) • Jan 6, 2020 • Edited`,
722 `Review 3`,
723 `View the full review: https://github.com/OWNER/REPO/pull/12#pullrequestreview-3`,
724 `loislane \(Owner\) • Jan 7, 2020`,
725 `Comment 4`,

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