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

Function TestPRView_Preview

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

Source from the content-addressed store, hash-verified

431}
432
433func TestPRView_Preview(t *testing.T) {
434 tests := map[string]struct {
435 branch string
436 args string
437 fixtures map[string]string
438 expectedOutputs []string
439 }{
440 "Open PR without metadata": {
441 branch: "master",
442 args: "12",
443 fixtures: map[string]string{
444 "PullRequestByNumber": "./fixtures/prViewPreview.json",
445 },
446 expectedOutputs: []string{
447 `Blueberries are from a fork OWNER/REPO#12`,
448 `Open.*nobody wants to merge 12 commits into master from blueberries . about X years ago`,
449 `.+100.-10`,
450 `blueberries taste good`,
451 `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
452 },
453 },
454 "Open PR with metadata by number": {
455 branch: "master",
456 args: "12",
457 fixtures: map[string]string{
458 "PullRequestByNumber": "./fixtures/prViewPreviewWithMetadataByNumber.json",
459 },
460 expectedOutputs: []string{
461 `Blueberries are from a fork OWNER/REPO#12`,
462 `Open.*nobody wants to merge 12 commits into master from blueberries . about X years ago`,
463 `.+100.-10`,
464 `Reviewers:.*1 \(.*Requested.*\)\n`,
465 `Assignees:.*marseilles, monaco\n`,
466 `Labels:.*Closed: Duplicate, Closed: Won't Fix, help wanted, Status: In Progress, Type: Bug\n`,
467 `Projects:.*v2 Project 1 \(No Status\), v2 Project 2 \(Done\), Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`,
468 `Milestone:.*uluru\n`,
469 `blueberries taste good`,
470 `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
471 },
472 },
473 "Open PR with reviewers by number": {
474 branch: "master",
475 args: "12",
476 fixtures: map[string]string{
477 "PullRequestByNumber": "./fixtures/prViewPreviewWithReviewersByNumber.json",
478 "ReviewsForPullRequest": "./fixtures/prViewPreviewManyReviews.json",
479 },
480 expectedOutputs: []string{
481 `Blueberries are from a fork OWNER/REPO#12`,
482 `Reviewers: DEF \(Commented\), def \(Changes requested\), ghost \(Approved\), hubot \(Commented\), xyz \(Approved\), 123 \(Requested\), abc \(Requested\), my-org\/team-1 \(Requested\)`,
483 `blueberries taste good`,
484 `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`,
485 },
486 },
487 "Closed PR": {
488 branch: "master",
489 args: "12",
490 fixtures: map[string]string{

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
ErrorfMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected