MCPcopy
hub / github.com/cli/cli / TestRunList_JSON

Function TestRunList_JSON

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

Source from the content-addressed store, hash-verified

521}
522
523func TestRunList_JSON(t *testing.T) {
524 defer gock.Off()
525 // gock.Observe(gock.DumpRequest)
526
527 // get user ID
528 gock.New("https://api.github.com").
529 Post("/graphql").
530 MatchType("json").
531 JSON(map[string]interface{}{
532 "query": "query UserOrgOwner.*",
533 "variables": map[string]interface{}{
534 "login": "monalisa",
535 },
536 }).
537 Reply(200).
538 JSON(map[string]interface{}{
539 "data": map[string]interface{}{
540 "user": map[string]interface{}{
541 "id": "an ID",
542 },
543 },
544 "errors": []interface{}{
545 map[string]interface{}{
546 "type": "NOT_FOUND",
547 "path": []string{"organization"},
548 },
549 },
550 })
551
552 // list project items
553 gock.New("https://api.github.com").
554 Post("/graphql").
555 JSON(map[string]interface{}{
556 "query": "query UserProjectWithItems.*",
557 "variables": map[string]interface{}{
558 "firstItems": queries.LimitDefault,
559 "afterItems": nil,
560 "firstFields": queries.LimitMax,
561 "afterFields": nil,
562 "login": "monalisa",
563 "number": 1,
564 },
565 }).
566 Reply(200).
567 JSON(map[string]interface{}{
568 "data": map[string]interface{}{
569 "user": map[string]interface{}{
570 "projectV2": map[string]interface{}{
571 "items": map[string]interface{}{
572 "nodes": []map[string]interface{}{
573 {
574 "id": "issue ID",
575 "content": map[string]interface{}{
576 "__typename": "Issue",
577 "title": "an issue",
578 "number": 1,
579 "repository": map[string]string{
580 "nameWithOwner": "cli/go-gh",

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected