(t *testing.T)
| 187 | } |
| 188 | |
| 189 | func TestRunItemEdit_Draft(t *testing.T) { |
| 190 | defer gock.Off() |
| 191 | // gock.Observe(gock.DumpRequest) |
| 192 | |
| 193 | // edit item |
| 194 | gock.New("https://api.github.com"). |
| 195 | Post("/graphql"). |
| 196 | BodyString(`{"query":"mutation EditDraftIssueItem.*","variables":{"input":{"draftIssueId":"DI_item_id","title":"a title","body":"a new body"}}}`). |
| 197 | Reply(200). |
| 198 | JSON(map[string]interface{}{ |
| 199 | "data": map[string]interface{}{ |
| 200 | "updateProjectV2DraftIssue": map[string]interface{}{ |
| 201 | "draftIssue": map[string]interface{}{ |
| 202 | "title": "a title", |
| 203 | "body": "a new body", |
| 204 | }, |
| 205 | }, |
| 206 | }, |
| 207 | }) |
| 208 | |
| 209 | client := queries.NewTestClient() |
| 210 | |
| 211 | ios, _, stdout, _ := iostreams.Test() |
| 212 | ios.SetStdoutTTY(true) |
| 213 | |
| 214 | config := editItemConfig{ |
| 215 | io: ios, |
| 216 | opts: editItemOpts{ |
| 217 | title: "a title", |
| 218 | titleChanged: true, |
| 219 | body: "a new body", |
| 220 | bodyChanged: true, |
| 221 | itemID: "DI_item_id", |
| 222 | }, |
| 223 | client: client, |
| 224 | } |
| 225 | |
| 226 | err := runEditItem(config) |
| 227 | assert.NoError(t, err) |
| 228 | assert.Equal( |
| 229 | t, |
| 230 | "Edited draft issue \"a title\"\n", |
| 231 | stdout.String()) |
| 232 | } |
| 233 | |
| 234 | func TestRunItemEdit_DraftTitleOnly(t *testing.T) { |
| 235 | defer gock.Off() |
nothing calls this directly
no test coverage detected