(t *testing.T)
| 617 | } |
| 618 | |
| 619 | func TestChecksRun_web(t *testing.T) { |
| 620 | tests := []struct { |
| 621 | name string |
| 622 | isTTY bool |
| 623 | wantStderr string |
| 624 | wantStdout string |
| 625 | wantBrowse string |
| 626 | }{ |
| 627 | { |
| 628 | name: "tty", |
| 629 | isTTY: true, |
| 630 | wantStderr: "Opening https://github.com/OWNER/REPO/pull/123/checks in your browser.\n", |
| 631 | wantStdout: "", |
| 632 | wantBrowse: "https://github.com/OWNER/REPO/pull/123/checks", |
| 633 | }, |
| 634 | { |
| 635 | name: "nontty", |
| 636 | isTTY: false, |
| 637 | wantStderr: "", |
| 638 | wantStdout: "", |
| 639 | wantBrowse: "https://github.com/OWNER/REPO/pull/123/checks", |
| 640 | }, |
| 641 | } |
| 642 | for _, tc := range tests { |
| 643 | t.Run(tc.name, func(t *testing.T) { |
| 644 | browser := &browser.Stub{} |
| 645 | |
| 646 | ios, _, stdout, stderr := iostreams.Test() |
| 647 | ios.SetStdoutTTY(tc.isTTY) |
| 648 | ios.SetStdinTTY(tc.isTTY) |
| 649 | ios.SetStderrTTY(tc.isTTY) |
| 650 | |
| 651 | _, teardown := run.Stub() |
| 652 | defer teardown(t) |
| 653 | |
| 654 | err := checksRunWebMode(&ChecksOptions{ |
| 655 | IO: ios, |
| 656 | Browser: browser, |
| 657 | WebMode: true, |
| 658 | SelectorArg: "123", |
| 659 | Finder: shared.NewMockFinder("123", &api.PullRequest{Number: 123}, ghrepo.New("OWNER", "REPO")), |
| 660 | }) |
| 661 | assert.NoError(t, err) |
| 662 | assert.Equal(t, tc.wantStdout, stdout.String()) |
| 663 | assert.Equal(t, tc.wantStderr, stderr.String()) |
| 664 | browser.Verify(t, tc.wantBrowse) |
| 665 | }) |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | func TestEliminateDuplicates(t *testing.T) { |
| 670 | tests := []struct { |
nothing calls this directly
no test coverage detected