(t *testing.T)
| 836 | } |
| 837 | |
| 838 | func TestIssueView_tty_Issues2NoFields(t *testing.T) { |
| 839 | ios, _, stdout, stderr := iostreams.Test() |
| 840 | ios.SetStdoutTTY(true) |
| 841 | ios.SetStdinTTY(true) |
| 842 | ios.SetStderrTTY(true) |
| 843 | |
| 844 | httpReg := &httpmock.Registry{} |
| 845 | defer httpReg.Verify(t) |
| 846 | |
| 847 | httpReg.Register( |
| 848 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 849 | httpmock.StringResponse(issueResponseNoIssues2Fields()), |
| 850 | ) |
| 851 | mockEmptyV2ProjectItems(t, httpReg) |
| 852 | |
| 853 | opts := ViewOptions{ |
| 854 | IO: ios, |
| 855 | Now: func() time.Time { |
| 856 | t, _ := time.Parse(time.RFC822, "03 Nov 24 15:04 UTC") |
| 857 | return t |
| 858 | }, |
| 859 | HttpClient: func() (*http.Client, error) { |
| 860 | return &http.Client{Transport: httpReg}, nil |
| 861 | }, |
| 862 | BaseRepo: func() (ghrepo.Interface, error) { |
| 863 | return ghrepo.New("OWNER", "REPO"), nil |
| 864 | }, |
| 865 | IssueNumber: 456, |
| 866 | } |
| 867 | |
| 868 | err := viewRun(&opts) |
| 869 | require.NoError(t, err) |
| 870 | |
| 871 | assert.Equal(t, "", stderr.String()) |
| 872 | |
| 873 | out := stdout.String() |
| 874 | |
| 875 | // Standard fields are still present |
| 876 | assert.Contains(t, out, "Fix login page") |
| 877 | assert.Contains(t, out, "OWNER/REPO#456") |
| 878 | assert.Contains(t, out, "Open") |
| 879 | assert.Contains(t, out, "The login page is broken.") |
| 880 | assert.Contains(t, out, "View this issue on GitHub: https://github.com/OWNER/REPO/issues/456") |
| 881 | |
| 882 | // Issues 2.0 sections must NOT appear |
| 883 | assert.NotContains(t, out, "Type:") |
| 884 | assert.NotContains(t, out, "Parent:") |
| 885 | assert.NotContains(t, out, "Blocked by:") |
| 886 | assert.NotContains(t, out, "Blocking:") |
| 887 | assert.NotContains(t, out, "Sub-issues") |
| 888 | } |
| 889 | |
| 890 | func TestIssueView_nontty_Issues2NoFields(t *testing.T) { |
| 891 | ios, _, stdout, stderr := iostreams.Test() |
nothing calls this directly
no test coverage detected