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

Function TestRunItemEdit_Text

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

Source from the content-addressed store, hash-verified

440}
441
442func TestRunItemEdit_Text(t *testing.T) {
443 defer gock.Off()
444 // gock.Observe(gock.DumpRequest)
445
446 // edit item
447 gock.New("https://api.github.com").
448 Post("/graphql").
449 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"text":"item text"}}}}`).
450 Reply(200).
451 JSON(map[string]any{
452 "data": map[string]any{
453 "updateProjectV2ItemFieldValue": map[string]any{
454 "projectV2Item": map[string]any{
455 "ID": "item_id",
456 "content": map[string]any{
457 "body": "body",
458 "title": "title",
459 "number": 1,
460 "repository": map[string]any{
461 "nameWithOwner": "my-repo",
462 },
463 },
464 },
465 },
466 },
467 })
468
469 client := queries.NewTestClient()
470
471 ios, _, stdout, _ := iostreams.Test()
472 config := editItemConfig{
473 io: ios,
474 opts: editItemOpts{
475 text: "item text",
476 itemID: "item_id",
477 projectID: "project_id",
478 fieldID: "field_id",
479 },
480 client: client,
481 }
482
483 err := runEditItem(config)
484 assert.NoError(t, err)
485 assert.Equal(t, "", stdout.String())
486}
487
488func TestRunItemEdit_Number(t *testing.T) {
489 defer gock.Off()

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
runEditItemFunction · 0.85
ReplyMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected