(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func TestRunItemEdit_Draft(t *testing.T) { |
| 250 | defer gock.Off() |
| 251 | // gock.Observe(gock.DumpRequest) |
| 252 | |
| 253 | // edit item |
| 254 | gock.New("https://api.github.com"). |
| 255 | Post("/graphql"). |
| 256 | BodyString(`{"query":"mutation EditDraftIssueItem.*","variables":{"input":{"draftIssueId":"DI_item_id","title":"a title","body":"a new body"}}}`). |
| 257 | Reply(200). |
| 258 | JSON(map[string]any{ |
| 259 | "data": map[string]any{ |
| 260 | "updateProjectV2DraftIssue": map[string]any{ |
| 261 | "draftIssue": map[string]any{ |
| 262 | "title": "a title", |
| 263 | "body": "a new body", |
| 264 | }, |
| 265 | }, |
| 266 | }, |
| 267 | }) |
| 268 | |
| 269 | client := queries.NewTestClient() |
| 270 | |
| 271 | ios, _, stdout, _ := iostreams.Test() |
| 272 | ios.SetStdoutTTY(true) |
| 273 | |
| 274 | config := editItemConfig{ |
| 275 | io: ios, |
| 276 | opts: editItemOpts{ |
| 277 | title: "a title", |
| 278 | titleChanged: true, |
| 279 | body: "a new body", |
| 280 | bodyChanged: true, |
| 281 | itemID: "DI_item_id", |
| 282 | }, |
| 283 | client: client, |
| 284 | } |
| 285 | |
| 286 | err := runEditItem(config) |
| 287 | assert.NoError(t, err) |
| 288 | assert.Equal( |
| 289 | t, |
| 290 | "Edited draft issue \"a title\"\n", |
| 291 | stdout.String()) |
| 292 | } |
| 293 | |
| 294 | func TestRunItemEdit_DraftTitleOnly(t *testing.T) { |
| 295 | defer gock.Off() |
nothing calls this directly
no test coverage detected