| 353 | } |
| 354 | |
| 355 | func TestRunList_Org(t *testing.T) { |
| 356 | defer gock.Off() |
| 357 | // gock.Observe(gock.DumpRequest) |
| 358 | |
| 359 | // get org ID |
| 360 | gock.New("https://api.github.com"). |
| 361 | Post("/graphql"). |
| 362 | MatchType("json"). |
| 363 | JSON(map[string]any{ |
| 364 | "query": "query UserOrgOwner.*", |
| 365 | "variables": map[string]any{ |
| 366 | "login": "github", |
| 367 | }, |
| 368 | }). |
| 369 | Reply(200). |
| 370 | JSON(map[string]any{ |
| 371 | "data": map[string]any{ |
| 372 | "organization": map[string]any{ |
| 373 | "id": "an ID", |
| 374 | }, |
| 375 | }, |
| 376 | "errors": []any{ |
| 377 | map[string]any{ |
| 378 | "type": "NOT_FOUND", |
| 379 | "path": []string{"user"}, |
| 380 | }, |
| 381 | }, |
| 382 | }) |
| 383 | |
| 384 | // list project items |
| 385 | gock.New("https://api.github.com"). |
| 386 | Post("/graphql"). |
| 387 | JSON(map[string]any{ |
| 388 | "query": "query OrgProjectWithItems.*", |
| 389 | "variables": map[string]any{ |
| 390 | "firstItems": queries.LimitDefault, |
| 391 | "afterItems": nil, |
| 392 | "firstFields": queries.LimitMax, |
| 393 | "afterFields": nil, |
| 394 | "login": "github", |
| 395 | "number": 1, |
| 396 | }, |
| 397 | }). |
| 398 | Reply(200). |
| 399 | JSON(map[string]any{ |
| 400 | "data": map[string]any{ |
| 401 | "organization": map[string]any{ |
| 402 | "projectV2": map[string]any{ |
| 403 | "items": map[string]any{ |
| 404 | "nodes": []map[string]any{ |
| 405 | { |
| 406 | "id": "issue ID", |
| 407 | "content": map[string]any{ |
| 408 | "__typename": "Issue", |
| 409 | "title": "an issue", |
| 410 | "number": 1, |
| 411 | "repository": map[string]string{ |
| 412 | "nameWithOwner": "cli/go-gh", |