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