MCPcopy Create free account
hub / github.com/cli/cli / TestRunItemEdit_DraftFetchError

Function TestRunItemEdit_DraftFetchError

pkg/cmd/project/item-edit/item_edit_test.go:406–440  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

404}
405
406func 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
442func TestRunItemEdit_Text(t *testing.T) {
443 defer gock.Off()

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
runEditItemFunction · 0.85
ReplyMethod · 0.80
ContainsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected