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

Function TestRunItemEdit_NumberZero

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

Source from the content-addressed store, hash-verified

539}
540
541func TestRunItemEdit_NumberZero(t *testing.T) {
542 defer gock.Off()
543 // gock.Observe(gock.DumpRequest)
544
545 // edit item
546 gock.New("https://api.github.com").
547 Post("/graphql").
548 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"number":0}}}}`).
549 Reply(200).
550 JSON(map[string]any{
551 "data": map[string]any{
552 "updateProjectV2ItemFieldValue": map[string]any{
553 "projectV2Item": map[string]any{
554 "ID": "item_id",
555 "content": map[string]any{
556 "__typename": "Issue",
557 "body": "body",
558 "title": "title",
559 "number": 1,
560 "repository": map[string]any{
561 "nameWithOwner": "my-repo",
562 },
563 },
564 },
565 },
566 },
567 })
568
569 client := queries.NewTestClient()
570
571 ios, _, stdout, _ := iostreams.Test()
572 ios.SetStdoutTTY(true)
573
574 config := editItemConfig{
575 io: ios,
576 opts: editItemOpts{
577 number: 0,
578 numberChanged: true,
579 itemID: "item_id",
580 projectID: "project_id",
581 fieldID: "field_id",
582 },
583 client: client,
584 }
585
586 err := runEditItem(config)
587 assert.NoError(t, err)
588 assert.Equal(
589 t,
590 "Edited item \"title\"\n",
591 stdout.String())
592}
593
594func TestRunItemEdit_Date(t *testing.T) {
595 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.65

Tested by

no test coverage detected