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

Function TestRunList_User

pkg/cmd/project/field-list/field_list_test.go:186–276  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestRunList_User(t *testing.T) {
187 defer gock.Off()
188 // gock.Observe(gock.DumpRequest)
189
190 // get user ID
191 gock.New("https://api.github.com").
192 Post("/graphql").
193 MatchType("json").
194 JSON(map[string]any{
195 "query": "query UserOrgOwner.*",
196 "variables": map[string]any{
197 "login": "monalisa",
198 },
199 }).
200 Reply(200).
201 JSON(map[string]any{
202 "data": map[string]any{
203 "user": map[string]any{
204 "id": "an ID",
205 },
206 },
207 "errors": []any{
208 map[string]any{
209 "type": "NOT_FOUND",
210 "path": []string{"organization"},
211 },
212 },
213 })
214
215 // list project fields
216 gock.New("https://api.github.com").
217 Post("/graphql").
218 JSON(map[string]any{
219 "query": "query UserProject.*",
220 "variables": map[string]any{
221 "login": "monalisa",
222 "number": 1,
223 "firstItems": queries.LimitMax,
224 "afterItems": nil,
225 "firstFields": queries.LimitDefault,
226 "afterFields": nil,
227 },
228 }).
229 Reply(200).
230 JSON(map[string]any{
231 "data": map[string]any{
232 "user": map[string]any{
233 "projectV2": map[string]any{
234 "fields": map[string]any{
235 "nodes": []map[string]any{
236 {
237 "__typename": "ProjectV2Field",
238 "name": "FieldTitle",
239 "id": "field ID",
240 },
241 {
242 "__typename": "ProjectV2SingleSelectField",
243 "name": "Status",

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected