(t *testing.T)
| 344 | } |
| 345 | |
| 346 | func TestRunItemEdit_DraftFetchError(t *testing.T) { |
| 347 | defer gock.Off() |
| 348 | |
| 349 | gock.New("https://api.github.com"). |
| 350 | Post("/graphql"). |
| 351 | BodyString(`{"query":"query DraftIssueByID.*","variables":{"id":"DI_item_id"}}`). |
| 352 | Reply(200). |
| 353 | JSON(map[string]interface{}{ |
| 354 | "errors": []map[string]interface{}{ |
| 355 | { |
| 356 | "type": "NOT_FOUND", |
| 357 | "message": "Could not resolve to a node with the global id of 'DI_item_id' (node)", |
| 358 | }, |
| 359 | }, |
| 360 | }) |
| 361 | |
| 362 | client := queries.NewTestClient() |
| 363 | |
| 364 | ios, _, _, _ := iostreams.Test() |
| 365 | |
| 366 | config := editItemConfig{ |
| 367 | io: ios, |
| 368 | opts: editItemOpts{ |
| 369 | title: "new title", |
| 370 | titleChanged: true, |
| 371 | bodyChanged: false, |
| 372 | itemID: "DI_item_id", |
| 373 | }, |
| 374 | client: client, |
| 375 | } |
| 376 | |
| 377 | err := runEditItem(config) |
| 378 | assert.Error(t, err) |
| 379 | assert.Contains(t, err.Error(), "Could not resolve to a node") |
| 380 | } |
| 381 | |
| 382 | func TestRunItemEdit_Text(t *testing.T) { |
| 383 | defer gock.Off() |
nothing calls this directly
no test coverage detected