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

Function TestPRView_tty_Comments

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

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected