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

Function TestPRView_nontty_Comments

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

Source from the content-addressed store, hash-verified

874}
875
876func TestPRView_nontty_Comments(t *testing.T) {
877 tests := map[string]struct {
878 branch string
879 cli string
880 fixtures map[string]string
881 expectedOutputs []string
882 wantsErr bool
883 }{
884 "without comments flag": {
885 branch: "master",
886 cli: "123",
887 fixtures: map[string]string{
888 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
889 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
890 },
891 expectedOutputs: []string{
892 `title:\tsome title`,
893 `state:\tOPEN`,
894 `author:\tnobody`,
895 `url:\thttps://github.com/OWNER/REPO/pull/12`,
896 `some body`,
897 },
898 },
899 "with comments flag": {
900 branch: "master",
901 cli: "123 --comments",
902 fixtures: map[string]string{
903 "PullRequestByNumber": "./fixtures/prViewPreviewSingleComment.json",
904 "ReviewsForPullRequest": "./fixtures/prViewPreviewReviews.json",
905 "CommentsForPullRequest": "./fixtures/prViewPreviewFullComments.json",
906 },
907 expectedOutputs: []string{
908 `author:\tmonalisa`,
909 `association:\tnone`,
910 `edited:\ttrue`,
911 `status:\tnone`,
912 `Comment 1`,
913 `author:\tsam`,
914 `association:\tnone`,
915 `edited:\tfalse`,
916 `status:\tcommented`,
917 `Review 1`,
918 `author:\tjohnnytest`,
919 `association:\tcontributor`,
920 `edited:\tfalse`,
921 `status:\tnone`,
922 `Comment 2`,
923 `author:\tmatt`,
924 `association:\towner`,
925 `edited:\tfalse`,
926 `status:\tchanges requested`,
927 `Review 2`,
928 `author:\telvisp`,
929 `association:\tmember`,
930 `edited:\tfalse`,
931 `status:\tnone`,
932 `Comment 3`,
933 `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