(t *testing.T)
| 521 | } |
| 522 | |
| 523 | func TestRunList_JSON(t *testing.T) { |
| 524 | defer gock.Off() |
| 525 | // gock.Observe(gock.DumpRequest) |
| 526 | |
| 527 | // get user ID |
| 528 | gock.New("https://api.github.com"). |
| 529 | Post("/graphql"). |
| 530 | MatchType("json"). |
| 531 | JSON(map[string]interface{}{ |
| 532 | "query": "query UserOrgOwner.*", |
| 533 | "variables": map[string]interface{}{ |
| 534 | "login": "monalisa", |
| 535 | }, |
| 536 | }). |
| 537 | Reply(200). |
| 538 | JSON(map[string]interface{}{ |
| 539 | "data": map[string]interface{}{ |
| 540 | "user": map[string]interface{}{ |
| 541 | "id": "an ID", |
| 542 | }, |
| 543 | }, |
| 544 | "errors": []interface{}{ |
| 545 | map[string]interface{}{ |
| 546 | "type": "NOT_FOUND", |
| 547 | "path": []string{"organization"}, |
| 548 | }, |
| 549 | }, |
| 550 | }) |
| 551 | |
| 552 | // list project items |
| 553 | gock.New("https://api.github.com"). |
| 554 | Post("/graphql"). |
| 555 | JSON(map[string]interface{}{ |
| 556 | "query": "query UserProjectWithItems.*", |
| 557 | "variables": map[string]interface{}{ |
| 558 | "firstItems": queries.LimitDefault, |
| 559 | "afterItems": nil, |
| 560 | "firstFields": queries.LimitMax, |
| 561 | "afterFields": nil, |
| 562 | "login": "monalisa", |
| 563 | "number": 1, |
| 564 | }, |
| 565 | }). |
| 566 | Reply(200). |
| 567 | JSON(map[string]interface{}{ |
| 568 | "data": map[string]interface{}{ |
| 569 | "user": map[string]interface{}{ |
| 570 | "projectV2": map[string]interface{}{ |
| 571 | "items": map[string]interface{}{ |
| 572 | "nodes": []map[string]interface{}{ |
| 573 | { |
| 574 | "id": "issue ID", |
| 575 | "content": map[string]interface{}{ |
| 576 | "__typename": "Issue", |
| 577 | "title": "an issue", |
| 578 | "number": 1, |
| 579 | "repository": map[string]string{ |
| 580 | "nameWithOwner": "cli/go-gh", |
nothing calls this directly
no test coverage detected