MCPcopy
hub / github.com/cli/cli / TestRunList_Me

Function TestRunList_Me

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

Source from the content-addressed store, hash-verified

330}
331
332func TestRunList_Me(t *testing.T) {
333 defer gock.Off()
334 gock.Observe(gock.DumpRequest)
335
336 // get viewer ID
337 gock.New("https://api.github.com").
338 Post("/graphql").
339 MatchType("json").
340 JSON(map[string]interface{}{
341 "query": "query ViewerOwner.*",
342 }).
343 Reply(200).
344 JSON(map[string]interface{}{
345 "data": map[string]interface{}{
346 "viewer": map[string]interface{}{
347 "id": "an ID",
348 },
349 },
350 })
351
352 gock.New("https://api.github.com").
353 Post("/graphql").
354 Reply(200).
355 JSON(map[string]interface{}{
356 "data": map[string]interface{}{
357 "viewer": map[string]interface{}{
358 "login": "monalisa",
359 "projectsV2": map[string]interface{}{
360 "nodes": []interface{}{
361 map[string]interface{}{
362 "title": "Project 1",
363 "shortDescription": "Short description 1",
364 "url": "url1",
365 "closed": false,
366 "ID": "id-1",
367 "number": 1,
368 },
369 map[string]interface{}{
370 "title": "Project 2",
371 "shortDescription": "",
372 "url": "url2",
373 "closed": true,
374 "ID": "id-2",
375 "number": 2,
376 },
377 },
378 },
379 },
380 },
381 })
382
383 client := queries.NewTestClient()
384
385 ios, _, stdout, _ := iostreams.Test()
386 config := listConfig{
387 opts: listOpts{
388 owner: "@me",
389 },

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