(t *testing.T)
| 827 | } |
| 828 | |
| 829 | func TestRunItemEdit_JSON(t *testing.T) { |
| 830 | defer gock.Off() |
| 831 | // gock.Observe(gock.DumpRequest) |
| 832 | |
| 833 | // edit item |
| 834 | gock.New("https://api.github.com"). |
| 835 | Post("/graphql"). |
| 836 | BodyString(`{"query":"mutation EditDraftIssueItem.*","variables":{"input":{"draftIssueId":"DI_item_id","title":"a title","body":"a new body"}}}`). |
| 837 | Reply(200). |
| 838 | JSON(map[string]any{ |
| 839 | "data": map[string]any{ |
| 840 | "updateProjectV2DraftIssue": map[string]any{ |
| 841 | "draftIssue": map[string]any{ |
| 842 | "id": "DI_item_id", |
| 843 | "title": "a title", |
| 844 | "body": "a new body", |
| 845 | }, |
| 846 | }, |
| 847 | }, |
| 848 | }) |
| 849 | |
| 850 | client := queries.NewTestClient() |
| 851 | |
| 852 | ios, _, stdout, _ := iostreams.Test() |
| 853 | config := editItemConfig{ |
| 854 | io: ios, |
| 855 | opts: editItemOpts{ |
| 856 | title: "a title", |
| 857 | titleChanged: true, |
| 858 | body: "a new body", |
| 859 | bodyChanged: true, |
| 860 | itemID: "DI_item_id", |
| 861 | exporter: cmdutil.NewJSONExporter(), |
| 862 | }, |
| 863 | client: client, |
| 864 | } |
| 865 | |
| 866 | err := runEditItem(config) |
| 867 | assert.NoError(t, err) |
| 868 | assert.JSONEq( |
| 869 | t, |
| 870 | `{"id":"DI_item_id","title":"a title","body":"a new body","type":"DraftIssue"}`, |
| 871 | stdout.String()) |
| 872 | } |
| 873 | |
| 874 | func TestRunItemEdit_ByName_SingleSelect(t *testing.T) { |
| 875 | defer gock.Off() |
nothing calls this directly
no test coverage detected