MCPcopy
hub / github.com/cli/cli / TestIssueView_nontty_Issues2NoFields

Function TestIssueView_nontty_Issues2NoFields

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

Source from the content-addressed store, hash-verified

876}
877
878func TestIssueView_nontty_Issues2NoFields(t *testing.T) {
879 ios, _, stdout, stderr := iostreams.Test()
880
881 httpReg := &httpmock.Registry{}
882 defer httpReg.Verify(t)
883
884 httpReg.Register(
885 httpmock.GraphQL(`query IssueByNumber\b`),
886 httpmock.StringResponse(issueResponseNoIssues2Fields()),
887 )
888 mockEmptyV2ProjectItems(t, httpReg)
889
890 opts := ViewOptions{
891 IO: ios,
892 Now: func() time.Time {
893 t, _ := time.Parse(time.RFC822, "03 Nov 24 15:04 UTC")
894 return t
895 },
896 HttpClient: func() (*http.Client, error) {
897 return &http.Client{Transport: httpReg}, nil
898 },
899 BaseRepo: func() (ghrepo.Interface, error) {
900 return ghrepo.New("OWNER", "REPO"), nil
901 },
902 IssueNumber: 456,
903 }
904
905 err := viewRun(&opts)
906 require.NoError(t, err)
907
908 assert.Equal(t, "", stderr.String())
909
910 out := stdout.String()
911
912 // Issues 2.0 keys appear with empty values to keep line counts stable
913 // for `head | grep` workflows.
914 assert.Contains(t, out, "issue-type:\t\n")
915 assert.Contains(t, out, "parent:\t\n")
916 assert.Contains(t, out, "sub-issues:\t\n")
917 assert.Contains(t, out, "sub-issues-completed:\t\n")
918 assert.Contains(t, out, "blocked-by:\t\n")
919 assert.Contains(t, out, "blocking:\t\n")
920}
921
922func TestIssueView_json_IssueType(t *testing.T) {
923 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.45

Tested by

no test coverage detected