(t *testing.T)
| 404 | } |
| 405 | |
| 406 | func TestRunItemEdit_DraftFetchError(t *testing.T) { |
| 407 | defer gock.Off() |
| 408 | |
| 409 | gock.New("https://api.github.com"). |
| 410 | Post("/graphql"). |
| 411 | BodyString(`{"query":"query DraftIssueByID.*","variables":{"id":"DI_item_id"}}`). |
| 412 | Reply(200). |
| 413 | JSON(map[string]any{ |
| 414 | "errors": []map[string]any{ |
| 415 | { |
| 416 | "type": "NOT_FOUND", |
| 417 | "message": "Could not resolve to a node with the global id of 'DI_item_id' (node)", |
| 418 | }, |
| 419 | }, |
| 420 | }) |
| 421 | |
| 422 | client := queries.NewTestClient() |
| 423 | |
| 424 | ios, _, _, _ := iostreams.Test() |
| 425 | |
| 426 | config := editItemConfig{ |
| 427 | io: ios, |
| 428 | opts: editItemOpts{ |
| 429 | title: "new title", |
| 430 | titleChanged: true, |
| 431 | bodyChanged: false, |
| 432 | itemID: "DI_item_id", |
| 433 | }, |
| 434 | client: client, |
| 435 | } |
| 436 | |
| 437 | err := runEditItem(config) |
| 438 | assert.Error(t, err) |
| 439 | assert.Contains(t, err.Error(), "Could not resolve to a node") |
| 440 | } |
| 441 | |
| 442 | func TestRunItemEdit_Text(t *testing.T) { |
| 443 | defer gock.Off() |
nothing calls this directly
no test coverage detected