MCPcopy
hub / github.com/cli/cli / TestRunItemEdit_NumberZero

Function TestRunItemEdit_NumberZero

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

Source from the content-addressed store, hash-verified

479}
480
481func TestRunItemEdit_NumberZero(t *testing.T) {
482 defer gock.Off()
483 // gock.Observe(gock.DumpRequest)
484
485 // edit item
486 gock.New("https://api.github.com").
487 Post("/graphql").
488 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"number":0}}}}`).
489 Reply(200).
490 JSON(map[string]interface{}{
491 "data": map[string]interface{}{
492 "updateProjectV2ItemFieldValue": map[string]interface{}{
493 "projectV2Item": map[string]interface{}{
494 "ID": "item_id",
495 "content": map[string]interface{}{
496 "__typename": "Issue",
497 "body": "body",
498 "title": "title",
499 "number": 1,
500 "repository": map[string]interface{}{
501 "nameWithOwner": "my-repo",
502 },
503 },
504 },
505 },
506 },
507 })
508
509 client := queries.NewTestClient()
510
511 ios, _, stdout, _ := iostreams.Test()
512 ios.SetStdoutTTY(true)
513
514 config := editItemConfig{
515 io: ios,
516 opts: editItemOpts{
517 number: 0,
518 numberChanged: true,
519 itemID: "item_id",
520 projectID: "project_id",
521 fieldID: "field_id",
522 },
523 client: client,
524 }
525
526 err := runEditItem(config)
527 assert.NoError(t, err)
528 assert.Equal(
529 t,
530 "Edited item \"title\"\n",
531 stdout.String())
532}
533
534func TestRunItemEdit_Date(t *testing.T) {
535 defer gock.Off()

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runEditItemFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected