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

Function TestRunList_User

pkg/cmd/project/item-list/item_list_test.go:248–353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246}
247
248func TestRunList_User(t *testing.T) {
249 defer gock.Off()
250 // gock.Observe(gock.DumpRequest)
251
252 // get user ID
253 gock.New("https://api.github.com").
254 Post("/graphql").
255 MatchType("json").
256 JSON(map[string]any{
257 "query": "query UserOrgOwner.*",
258 "variables": map[string]any{
259 "login": "monalisa",
260 },
261 }).
262 Reply(200).
263 JSON(map[string]any{
264 "data": map[string]any{
265 "user": map[string]any{
266 "id": "an ID",
267 },
268 },
269 "errors": []any{
270 map[string]any{
271 "type": "NOT_FOUND",
272 "path": []string{"organization"},
273 },
274 },
275 })
276
277 // list project items
278 gock.New("https://api.github.com").
279 Post("/graphql").
280 JSON(map[string]any{
281 "query": "query UserProjectWithItems.*",
282 "variables": map[string]any{
283 "firstItems": queries.LimitDefault,
284 "afterItems": nil,
285 "firstFields": queries.LimitMax,
286 "afterFields": nil,
287 "login": "monalisa",
288 "number": 1,
289 },
290 }).
291 Reply(200).
292 JSON(map[string]any{
293 "data": map[string]any{
294 "user": map[string]any{
295 "projectV2": map[string]any{
296 "items": map[string]any{
297 "nodes": []map[string]any{
298 {
299 "id": "issue ID",
300 "content": map[string]any{
301 "__typename": "Issue",
302 "title": "an issue",
303 "number": 1,
304 "repository": map[string]string{
305 "nameWithOwner": "cli/go-gh",

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected