(t *testing.T)
| 888 | } |
| 889 | |
| 890 | func TestIssueView_nontty_Issues2NoFields(t *testing.T) { |
| 891 | ios, _, stdout, stderr := iostreams.Test() |
| 892 | |
| 893 | httpReg := &httpmock.Registry{} |
| 894 | defer httpReg.Verify(t) |
| 895 | |
| 896 | httpReg.Register( |
| 897 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 898 | httpmock.StringResponse(issueResponseNoIssues2Fields()), |
| 899 | ) |
| 900 | mockEmptyV2ProjectItems(t, httpReg) |
| 901 | |
| 902 | opts := ViewOptions{ |
| 903 | IO: ios, |
| 904 | Now: func() time.Time { |
| 905 | t, _ := time.Parse(time.RFC822, "03 Nov 24 15:04 UTC") |
| 906 | return t |
| 907 | }, |
| 908 | HttpClient: func() (*http.Client, error) { |
| 909 | return &http.Client{Transport: httpReg}, nil |
| 910 | }, |
| 911 | BaseRepo: func() (ghrepo.Interface, error) { |
| 912 | return ghrepo.New("OWNER", "REPO"), nil |
| 913 | }, |
| 914 | IssueNumber: 456, |
| 915 | } |
| 916 | |
| 917 | err := viewRun(&opts) |
| 918 | require.NoError(t, err) |
| 919 | |
| 920 | assert.Equal(t, "", stderr.String()) |
| 921 | |
| 922 | out := stdout.String() |
| 923 | |
| 924 | // Issues 2.0 keys appear with empty values to keep line counts stable |
| 925 | // for `head | grep` workflows. |
| 926 | assert.Contains(t, out, "issue-type:\t\n") |
| 927 | assert.Contains(t, out, "parent:\t\n") |
| 928 | assert.Contains(t, out, "sub-issues:\t\n") |
| 929 | assert.Contains(t, out, "sub-issues-completed:\t\n") |
| 930 | assert.Contains(t, out, "blocked-by:\t\n") |
| 931 | assert.Contains(t, out, "blocking:\t\n") |
| 932 | } |
| 933 | |
| 934 | func TestIssueView_json_IssueType(t *testing.T) { |
| 935 | httpReg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected