(t *testing.T)
| 626 | } |
| 627 | |
| 628 | func TestRunItemEdit_Iteration(t *testing.T) { |
| 629 | defer gock.Off() |
| 630 | // gock.Observe(gock.DumpRequest) |
| 631 | |
| 632 | // edit item |
| 633 | gock.New("https://api.github.com"). |
| 634 | Post("/graphql"). |
| 635 | BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"iterationId":"option_id"}}}}`). |
| 636 | Reply(200). |
| 637 | JSON(map[string]interface{}{ |
| 638 | "data": map[string]interface{}{ |
| 639 | "updateProjectV2ItemFieldValue": map[string]interface{}{ |
| 640 | "projectV2Item": map[string]interface{}{ |
| 641 | "ID": "item_id", |
| 642 | "content": map[string]interface{}{ |
| 643 | "__typename": "Issue", |
| 644 | "body": "body", |
| 645 | "title": "title", |
| 646 | "number": 1, |
| 647 | "repository": map[string]interface{}{ |
| 648 | "nameWithOwner": "my-repo", |
| 649 | }, |
| 650 | }, |
| 651 | }, |
| 652 | }, |
| 653 | }, |
| 654 | }) |
| 655 | |
| 656 | client := queries.NewTestClient() |
| 657 | |
| 658 | ios, _, stdout, _ := iostreams.Test() |
| 659 | ios.SetStdoutTTY(true) |
| 660 | |
| 661 | config := editItemConfig{ |
| 662 | io: ios, |
| 663 | opts: editItemOpts{ |
| 664 | iterationID: "option_id", |
| 665 | itemID: "item_id", |
| 666 | projectID: "project_id", |
| 667 | fieldID: "field_id", |
| 668 | }, |
| 669 | client: client, |
| 670 | } |
| 671 | |
| 672 | err := runEditItem(config) |
| 673 | assert.NoError(t, err) |
| 674 | assert.Equal( |
| 675 | t, |
| 676 | "Edited item \"title\"\n", |
| 677 | stdout.String()) |
| 678 | } |
| 679 | |
| 680 | func TestRunItemEdit_NoChanges(t *testing.T) { |
| 681 | defer gock.Off() |
nothing calls this directly
no test coverage detected