MCPcopy
hub / github.com/cli/cli / TestRunList

Function TestRunList

pkg/cmd/project/list/list_test.go:174–250  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

172}
173
174func TestRunList(t *testing.T) {
175 defer gock.Off()
176 gock.Observe(gock.DumpRequest)
177 // get user ID
178 gock.New("https://api.github.com").
179 Post("/graphql").
180 MatchType("json").
181 JSON(map[string]interface{}{
182 "query": "query UserOrgOwner.*",
183 "variables": map[string]interface{}{
184 "login": "monalisa",
185 },
186 }).
187 Reply(200).
188 JSON(map[string]interface{}{
189 "data": map[string]interface{}{
190 "user": map[string]interface{}{
191 "id": "an ID",
192 },
193 },
194 "errors": []interface{}{
195 map[string]interface{}{
196 "type": "NOT_FOUND",
197 "path": []string{"organization"},
198 },
199 },
200 })
201
202 gock.New("https://api.github.com").
203 Post("/graphql").
204 Reply(200).
205 JSON(map[string]interface{}{
206 "data": map[string]interface{}{
207 "user": map[string]interface{}{
208 "login": "monalisa",
209 "projectsV2": map[string]interface{}{
210 "nodes": []interface{}{
211 map[string]interface{}{
212 "title": "Project 1",
213 "shortDescription": "Short description 1",
214 "url": "url1",
215 "closed": false,
216 "ID": "id-1",
217 "number": 1,
218 },
219 map[string]interface{}{
220 "title": "Project 2",
221 "shortDescription": "",
222 "url": "url2",
223 "closed": true,
224 "ID": "id-2",
225 "number": 2,
226 },
227 },
228 },
229 },
230 },
231 })

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected