MCPcopy
hub / github.com/cli/cli / TestProjectItems_LowerLimit

Function TestProjectItems_LowerLimit

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

Source from the content-addressed store, hash-verified

119}
120
121func TestProjectItems_LowerLimit(t *testing.T) {
122 defer gock.Off()
123 gock.Observe(gock.DumpRequest)
124
125 // list project items
126 gock.New("https://api.github.com").
127 Post("/graphql").
128 JSON(map[string]interface{}{
129 "query": "query UserProjectWithItems.*",
130 "variables": map[string]interface{}{
131 "firstItems": 2,
132 "afterItems": nil,
133 "firstFields": LimitMax,
134 "afterFields": nil,
135 "login": "monalisa",
136 "number": 1,
137 },
138 }).
139 Reply(200).
140 JSON(map[string]interface{}{
141 "data": map[string]interface{}{
142 "user": map[string]interface{}{
143 "projectV2": map[string]interface{}{
144 "items": map[string]interface{}{
145 "nodes": []map[string]interface{}{
146 {
147 "id": "issue ID",
148 },
149 {
150 "id": "pull request ID",
151 },
152 },
153 },
154 },
155 },
156 },
157 })
158
159 client := NewTestClient()
160
161 owner := &Owner{
162 Type: "USER",
163 Login: "monalisa",
164 ID: "user ID",
165 }
166 project, err := client.ProjectItems(owner, 1, 2, "")
167 assert.NoError(t, err)
168 assert.Len(t, project.Items.Nodes, 2)
169}
170
171func TestProjectItems_NoLimit(t *testing.T) {
172 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