| 246 | } |
| 247 | |
| 248 | func TestRunList_User(t *testing.T) { |
| 249 | defer gock.Off() |
| 250 | // gock.Observe(gock.DumpRequest) |
| 251 | |
| 252 | // get user ID |
| 253 | gock.New("https://api.github.com"). |
| 254 | Post("/graphql"). |
| 255 | MatchType("json"). |
| 256 | JSON(map[string]any{ |
| 257 | "query": "query UserOrgOwner.*", |
| 258 | "variables": map[string]any{ |
| 259 | "login": "monalisa", |
| 260 | }, |
| 261 | }). |
| 262 | Reply(200). |
| 263 | JSON(map[string]any{ |
| 264 | "data": map[string]any{ |
| 265 | "user": map[string]any{ |
| 266 | "id": "an ID", |
| 267 | }, |
| 268 | }, |
| 269 | "errors": []any{ |
| 270 | map[string]any{ |
| 271 | "type": "NOT_FOUND", |
| 272 | "path": []string{"organization"}, |
| 273 | }, |
| 274 | }, |
| 275 | }) |
| 276 | |
| 277 | // list project items |
| 278 | gock.New("https://api.github.com"). |
| 279 | Post("/graphql"). |
| 280 | JSON(map[string]any{ |
| 281 | "query": "query UserProjectWithItems.*", |
| 282 | "variables": map[string]any{ |
| 283 | "firstItems": queries.LimitDefault, |
| 284 | "afterItems": nil, |
| 285 | "firstFields": queries.LimitMax, |
| 286 | "afterFields": nil, |
| 287 | "login": "monalisa", |
| 288 | "number": 1, |
| 289 | }, |
| 290 | }). |
| 291 | Reply(200). |
| 292 | JSON(map[string]any{ |
| 293 | "data": map[string]any{ |
| 294 | "user": map[string]any{ |
| 295 | "projectV2": map[string]any{ |
| 296 | "items": map[string]any{ |
| 297 | "nodes": []map[string]any{ |
| 298 | { |
| 299 | "id": "issue ID", |
| 300 | "content": map[string]any{ |
| 301 | "__typename": "Issue", |
| 302 | "title": "an issue", |
| 303 | "number": 1, |
| 304 | "repository": map[string]string{ |
| 305 | "nameWithOwner": "cli/go-gh", |