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

Function TestRunListViewer

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

Source from the content-addressed store, hash-verified

400}
401
402func TestRunListViewer(t *testing.T) {
403 defer gock.Off()
404 gock.Observe(gock.DumpRequest)
405
406 // get viewer ID
407 gock.New("https://api.github.com").
408 Post("/graphql").
409 MatchType("json").
410 JSON(map[string]interface{}{
411 "query": "query ViewerOwner.*",
412 }).
413 Reply(200).
414 JSON(map[string]interface{}{
415 "data": map[string]interface{}{
416 "viewer": map[string]interface{}{
417 "id": "an ID",
418 },
419 },
420 })
421
422 gock.New("https://api.github.com").
423 Post("/graphql").
424 Reply(200).
425 JSON(map[string]interface{}{
426 "data": map[string]interface{}{
427 "viewer": map[string]interface{}{
428 "login": "monalisa",
429 "projectsV2": map[string]interface{}{
430 "nodes": []interface{}{
431 map[string]interface{}{
432 "title": "Project 1",
433 "shortDescription": "Short description 1",
434 "url": "url1",
435 "closed": false,
436 "ID": "id-1",
437 "number": 1,
438 },
439 map[string]interface{}{
440 "title": "Project 2",
441 "shortDescription": "",
442 "url": "url2",
443 "closed": true,
444 "ID": "id-2",
445 "number": 2,
446 },
447 },
448 },
449 },
450 },
451 })
452
453 client := queries.NewTestClient()
454
455 ios, _, stdout, _ := iostreams.Test()
456 config := listConfig{
457 opts: listOpts{},
458 client: client,
459 io: ios,

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