MCPcopy
hub / github.com/cli/cli / TestProjectItems_DefaultLimit

Function TestProjectItems_DefaultLimit

pkg/cmd/project/shared/queries/queries_test.go:68–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestProjectItems_DefaultLimit(t *testing.T) {
69 defer gock.Off()
70 gock.Observe(gock.DumpRequest)
71
72 // list project items
73 gock.New("https://api.github.com").
74 Post("/graphql").
75 JSON(map[string]interface{}{
76 "query": "query UserProjectWithItems.*",
77 "variables": map[string]interface{}{
78 "firstItems": LimitMax,
79 "afterItems": nil,
80 "firstFields": LimitMax,
81 "afterFields": nil,
82 "login": "monalisa",
83 "number": 1,
84 },
85 }).
86 Reply(200).
87 JSON(map[string]interface{}{
88 "data": map[string]interface{}{
89 "user": map[string]interface{}{
90 "projectV2": map[string]interface{}{
91 "items": map[string]interface{}{
92 "nodes": []map[string]interface{}{
93 {
94 "id": "issue ID",
95 },
96 {
97 "id": "pull request ID",
98 },
99 {
100 "id": "draft issue ID",
101 },
102 },
103 },
104 },
105 },
106 },
107 })
108
109 client := NewTestClient()
110
111 owner := &Owner{
112 Type: "USER",
113 Login: "monalisa",
114 ID: "user ID",
115 }
116 project, err := client.ProjectItems(owner, 1, LimitMax, "")
117 assert.NoError(t, err)
118 assert.Len(t, project.Items.Nodes, 3)
119}
120
121func TestProjectItems_LowerLimit(t *testing.T) {
122 defer gock.Off()

Callers

nothing calls this directly

Calls 4

ReplyMethod · 0.80
ProjectItemsMethod · 0.80
NewTestClientFunction · 0.70
LenMethod · 0.65

Tested by

no test coverage detected