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

Function TestPRView_tty_wrappedLink

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

Source from the content-addressed store, hash-verified

639}
640
641func TestPRView_tty_wrappedLink(t *testing.T) {
642 t.Setenv("GLAMOUR_STYLE", "notty")
643
644 ios, _, stdout, stderr := iostreams.Test()
645 ios.SetStdoutTTY(true)
646
647 now := time.Date(2026, time.January, 1, 0, 0, 0, 0, time.UTC)
648 pr := &api.PullRequest{
649 Number: 123,
650 CreatedAt: now,
651 Body: "https://user-images.githubusercontent.com/1532486/119571265-fe41be00-bd65-11eb-8c99-a3eaec2a9b1c.png",
652 }
653 opts := &ViewOptions{
654 IO: ios,
655 Finder: shared.NewMockFinder("123", pr, ghrepo.New("OWNER", "REPO")),
656 SelectorArg: "123",
657 Now: func() time.Time { return now },
658 }
659
660 require.NoError(t, viewRun(opts))
661 assert.Empty(t, stderr.String())
662 assert.Contains(t, stdout.String(),
663 "\x1b]8;id=105816246;https://user-images.githubusercontent.com/1532486/119571265-fe41be00-bd65-11eb-8c99-a3eaec2a9b1c.png\ahttps://user-images.githubusercontent.com/1532486/119571265-fe41be00-bd65-\x1b]8;;\a \n"+
664 " \x1b]8;id=105816246;https://user-images.githubusercontent.com/1532486/119571265-fe41be00-bd65-11eb-8c99-a3eaec2a9b1c.png\a11eb-8c99-a3eaec2a9b1c.png\x1b]8;;\a")
665}
666
667func TestPRView_eventListenHint(t *testing.T) {
668 const hint = "hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling:\n" +

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewMockFinderFunction · 0.92
NewFunction · 0.92
SetStdoutTTYMethod · 0.80
EmptyMethod · 0.80
ContainsMethod · 0.80
viewRunFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected