| 666 | } |
| 667 | |
| 668 | func TestRunList_WithQuery(t *testing.T) { |
| 669 | defer gock.Off() |
| 670 | |
| 671 | // get user ID |
| 672 | gock.New("https://api.github.com"). |
| 673 | Post("/graphql"). |
| 674 | MatchType("json"). |
| 675 | JSON(map[string]any{ |
| 676 | "query": "query UserOrgOwner.*", |
| 677 | "variables": map[string]any{ |
| 678 | "login": "monalisa", |
| 679 | }, |
| 680 | }). |
| 681 | Reply(200). |
| 682 | JSON(map[string]any{ |
| 683 | "data": map[string]any{ |
| 684 | "user": map[string]any{ |
| 685 | "id": "an ID", |
| 686 | }, |
| 687 | }, |
| 688 | "errors": []any{ |
| 689 | map[string]any{ |
| 690 | "type": "NOT_FOUND", |
| 691 | "path": []string{"organization"}, |
| 692 | }, |
| 693 | }, |
| 694 | }) |
| 695 | |
| 696 | // list project items with query |
| 697 | gock.New("https://api.github.com"). |
| 698 | Post("/graphql"). |
| 699 | JSON(map[string]any{ |
| 700 | "query": "query UserProjectWithItems.*", |
| 701 | "variables": map[string]any{ |
| 702 | "firstItems": queries.LimitDefault, |
| 703 | "afterItems": nil, |
| 704 | "firstFields": queries.LimitMax, |
| 705 | "afterFields": nil, |
| 706 | "login": "monalisa", |
| 707 | "number": 1, |
| 708 | "query": "assignee:octocat -status:Done", |
| 709 | }, |
| 710 | }). |
| 711 | Reply(200). |
| 712 | JSON(map[string]any{ |
| 713 | "data": map[string]any{ |
| 714 | "user": map[string]any{ |
| 715 | "projectV2": map[string]any{ |
| 716 | "items": map[string]any{ |
| 717 | "nodes": []map[string]any{ |
| 718 | { |
| 719 | "id": "issue ID", |
| 720 | "content": map[string]any{ |
| 721 | "__typename": "Issue", |
| 722 | "title": "an issue", |
| 723 | "number": 1, |
| 724 | "repository": map[string]string{ |
| 725 | "nameWithOwner": "cli/go-gh", |