MCPcopy
hub / github.com/cli/cli / TestRunList_WithQuery

Function TestRunList_WithQuery

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

Source from the content-addressed store, hash-verified

630}
631
632func TestRunList_WithQuery(t *testing.T) {
633 defer gock.Off()
634
635 // get user ID
636 gock.New("https://api.github.com").
637 Post("/graphql").
638 MatchType("json").
639 JSON(map[string]interface{}{
640 "query": "query UserOrgOwner.*",
641 "variables": map[string]interface{}{
642 "login": "monalisa",
643 },
644 }).
645 Reply(200).
646 JSON(map[string]interface{}{
647 "data": map[string]interface{}{
648 "user": map[string]interface{}{
649 "id": "an ID",
650 },
651 },
652 "errors": []interface{}{
653 map[string]interface{}{
654 "type": "NOT_FOUND",
655 "path": []string{"organization"},
656 },
657 },
658 })
659
660 // list project items with query
661 gock.New("https://api.github.com").
662 Post("/graphql").
663 JSON(map[string]interface{}{
664 "query": "query UserProjectWithItems.*",
665 "variables": map[string]interface{}{
666 "firstItems": queries.LimitDefault,
667 "afterItems": nil,
668 "firstFields": queries.LimitMax,
669 "afterFields": nil,
670 "login": "monalisa",
671 "number": 1,
672 "query": "assignee:octocat -status:Done",
673 },
674 }).
675 Reply(200).
676 JSON(map[string]interface{}{
677 "data": map[string]interface{}{
678 "user": map[string]interface{}{
679 "projectV2": map[string]interface{}{
680 "items": map[string]interface{}{
681 "nodes": []map[string]interface{}{
682 {
683 "id": "issue ID",
684 "content": map[string]interface{}{
685 "__typename": "Issue",
686 "title": "an issue",
687 "number": 1,
688 "repository": map[string]string{
689 "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.45

Tested by

no test coverage detected