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

Function TestPRView_Preview

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

Source from the content-addressed store, hash-verified

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