(t *testing.T)
| 686 | } |
| 687 | |
| 688 | func TestRunItemEdit_Iteration(t *testing.T) { |
| 689 | defer gock.Off() |
| 690 | // gock.Observe(gock.DumpRequest) |
| 691 | |
| 692 | // edit item |
| 693 | gock.New("https://api.github.com"). |
| 694 | Post("/graphql"). |
| 695 | BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"iterationId":"option_id"}}}}`). |
| 696 | Reply(200). |
| 697 | JSON(map[string]any{ |
| 698 | "data": map[string]any{ |
| 699 | "updateProjectV2ItemFieldValue": map[string]any{ |
| 700 | "projectV2Item": map[string]any{ |
| 701 | "ID": "item_id", |
| 702 | "content": map[string]any{ |
| 703 | "__typename": "Issue", |
| 704 | "body": "body", |
| 705 | "title": "title", |
| 706 | "number": 1, |
| 707 | "repository": map[string]any{ |
| 708 | "nameWithOwner": "my-repo", |
| 709 | }, |
| 710 | }, |
| 711 | }, |
| 712 | }, |
| 713 | }, |
| 714 | }) |
| 715 | |
| 716 | client := queries.NewTestClient() |
| 717 | |
| 718 | ios, _, stdout, _ := iostreams.Test() |
| 719 | ios.SetStdoutTTY(true) |
| 720 | |
| 721 | config := editItemConfig{ |
| 722 | io: ios, |
| 723 | opts: editItemOpts{ |
| 724 | iterationID: "option_id", |
| 725 | itemID: "item_id", |
| 726 | projectID: "project_id", |
| 727 | fieldID: "field_id", |
| 728 | }, |
| 729 | client: client, |
| 730 | } |
| 731 | |
| 732 | err := runEditItem(config) |
| 733 | assert.NoError(t, err) |
| 734 | assert.Equal( |
| 735 | t, |
| 736 | "Edited item \"title\"\n", |
| 737 | stdout.String()) |
| 738 | } |
| 739 | |
| 740 | func TestRunItemEdit_NoChanges(t *testing.T) { |
| 741 | defer gock.Off() |
nothing calls this directly
no test coverage detected