MCPcopy Index your code
hub / github.com/cli/cli / TestIssueList_pagination

Function TestIssueList_pagination

pkg/cmd/issue/list/http_test.go:88–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestIssueList_pagination(t *testing.T) {
89 reg := &httpmock.Registry{}
90 httpClient := &http.Client{}
91 httpmock.ReplaceTripper(httpClient, reg)
92 client := api.NewClientFromHTTP(httpClient)
93
94 reg.Register(
95 httpmock.GraphQL(`query IssueList\b`),
96 httpmock.StringResponse(`
97 { "data": { "repository": {
98 "hasIssuesEnabled": true,
99 "issues": {
100 "nodes": [
101 {
102 "title": "issue1",
103 "labels": { "nodes": [ { "name": "bug" } ], "totalCount": 1 },
104 "assignees": { "nodes": [ { "login": "user1" } ], "totalCount": 1 }
105 }
106 ],
107 "pageInfo": {
108 "hasNextPage": true,
109 "endCursor": "ENDCURSOR"
110 },
111 "totalCount": 2
112 }
113 } } }
114 `),
115 )
116
117 reg.Register(
118 httpmock.GraphQL(`query IssueList\b`),
119 httpmock.StringResponse(`
120 { "data": { "repository": {
121 "hasIssuesEnabled": true,
122 "issues": {
123 "nodes": [
124 {
125 "title": "issue2",
126 "labels": { "nodes": [ { "name": "enhancement" } ], "totalCount": 1 },
127 "assignees": { "nodes": [ { "login": "user2" } ], "totalCount": 1 }
128 }
129 ],
130 "pageInfo": {
131 "hasNextPage": false,
132 "endCursor": "ENDCURSOR"
133 },
134 "totalCount": 2
135 }
136 } } }
137 `),
138 )
139
140 repo := ghrepo.New("OWNER", "REPO")
141 res, err := listIssues(client, repo, prShared.FilterOptions{}, 0)
142 if err != nil {
143 t.Fatalf("IssueList() error = %v", err)
144 }
145

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
ReplaceTripperFunction · 0.92
NewClientFromHTTPFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
listIssuesFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected