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

Function TestIssueView_nontty_Issues2NoFields

pkg/cmd/issue/view/view_test.go:890–932  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

888}
889
890func 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
934func TestIssueView_json_IssueType(t *testing.T) {
935 httpReg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 12

VerifyMethod · 0.95
RegisterMethod · 0.95
TestFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
mockEmptyV2ProjectItemsFunction · 0.85
EqualMethod · 0.80
ContainsMethod · 0.80
viewRunFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected