(t *testing.T)
| 579 | } |
| 580 | |
| 581 | func TestRunItemEdit_SingleSelect(t *testing.T) { |
| 582 | defer gock.Off() |
| 583 | // gock.Observe(gock.DumpRequest) |
| 584 | |
| 585 | // edit item |
| 586 | gock.New("https://api.github.com"). |
| 587 | Post("/graphql"). |
| 588 | BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"singleSelectOptionId":"option_id"}}}}`). |
| 589 | Reply(200). |
| 590 | JSON(map[string]interface{}{ |
| 591 | "data": map[string]interface{}{ |
| 592 | "updateProjectV2ItemFieldValue": map[string]interface{}{ |
| 593 | "projectV2Item": map[string]interface{}{ |
| 594 | "ID": "item_id", |
| 595 | "content": map[string]interface{}{ |
| 596 | "__typename": "Issue", |
| 597 | "body": "body", |
| 598 | "title": "title", |
| 599 | "number": 1, |
| 600 | "repository": map[string]interface{}{ |
| 601 | "nameWithOwner": "my-repo", |
| 602 | }, |
| 603 | }, |
| 604 | }, |
| 605 | }, |
| 606 | }, |
| 607 | }) |
| 608 | |
| 609 | client := queries.NewTestClient() |
| 610 | |
| 611 | ios, _, stdout, _ := iostreams.Test() |
| 612 | config := editItemConfig{ |
| 613 | io: ios, |
| 614 | opts: editItemOpts{ |
| 615 | singleSelectOptionID: "option_id", |
| 616 | itemID: "item_id", |
| 617 | projectID: "project_id", |
| 618 | fieldID: "field_id", |
| 619 | }, |
| 620 | client: client, |
| 621 | } |
| 622 | |
| 623 | err := runEditItem(config) |
| 624 | assert.NoError(t, err) |
| 625 | assert.Equal(t, "", stdout.String()) |
| 626 | } |
| 627 | |
| 628 | func TestRunItemEdit_Iteration(t *testing.T) { |
| 629 | defer gock.Off() |
nothing calls this directly
no test coverage detected