MCPcopy
hub / github.com/cli/cli / TestRunItemEdit_DraftFetchError

Function TestRunItemEdit_DraftFetchError

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

Source from the content-addressed store, hash-verified

344}
345
346func 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
382func TestRunItemEdit_Text(t *testing.T) {
383 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