MCPcopy Index your code
hub / github.com/cli/cli / TestPRView_Preview

Function TestPRView_Preview

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

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected