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

Function TestRunList_JSON

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

Source from the content-addressed store, hash-verified

557}
558
559func TestRunList_JSON(t *testing.T) {
560 defer gock.Off()
561 // gock.Observe(gock.DumpRequest)
562
563 // get user ID
564 gock.New("https://api.github.com").
565 Post("/graphql").
566 MatchType("json").
567 JSON(map[string]any{
568 "query": "query UserOrgOwner.*",
569 "variables": map[string]any{
570 "login": "monalisa",
571 },
572 }).
573 Reply(200).
574 JSON(map[string]any{
575 "data": map[string]any{
576 "user": map[string]any{
577 "id": "an ID",
578 },
579 },
580 "errors": []any{
581 map[string]any{
582 "type": "NOT_FOUND",
583 "path": []string{"organization"},
584 },
585 },
586 })
587
588 // list project items
589 gock.New("https://api.github.com").
590 Post("/graphql").
591 JSON(map[string]any{
592 "query": "query UserProjectWithItems.*",
593 "variables": map[string]any{
594 "firstItems": queries.LimitDefault,
595 "afterItems": nil,
596 "firstFields": queries.LimitMax,
597 "afterFields": nil,
598 "login": "monalisa",
599 "number": 1,
600 },
601 }).
602 Reply(200).
603 JSON(map[string]any{
604 "data": map[string]any{
605 "user": map[string]any{
606 "projectV2": map[string]any{
607 "items": map[string]any{
608 "nodes": []map[string]any{
609 {
610 "id": "issue ID",
611 "content": map[string]any{
612 "__typename": "Issue",
613 "title": "an issue",
614 "number": 1,
615 "repository": map[string]string{
616 "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.65

Tested by

no test coverage detected