MCPcopy
hub / github.com/cli/cli / TestRunItemEdit_Iteration

Function TestRunItemEdit_Iteration

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

Source from the content-addressed store, hash-verified

626}
627
628func TestRunItemEdit_Iteration(t *testing.T) {
629 defer gock.Off()
630 // gock.Observe(gock.DumpRequest)
631
632 // edit item
633 gock.New("https://api.github.com").
634 Post("/graphql").
635 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"iterationId":"option_id"}}}}`).
636 Reply(200).
637 JSON(map[string]interface{}{
638 "data": map[string]interface{}{
639 "updateProjectV2ItemFieldValue": map[string]interface{}{
640 "projectV2Item": map[string]interface{}{
641 "ID": "item_id",
642 "content": map[string]interface{}{
643 "__typename": "Issue",
644 "body": "body",
645 "title": "title",
646 "number": 1,
647 "repository": map[string]interface{}{
648 "nameWithOwner": "my-repo",
649 },
650 },
651 },
652 },
653 },
654 })
655
656 client := queries.NewTestClient()
657
658 ios, _, stdout, _ := iostreams.Test()
659 ios.SetStdoutTTY(true)
660
661 config := editItemConfig{
662 io: ios,
663 opts: editItemOpts{
664 iterationID: "option_id",
665 itemID: "item_id",
666 projectID: "project_id",
667 fieldID: "field_id",
668 },
669 client: client,
670 }
671
672 err := runEditItem(config)
673 assert.NoError(t, err)
674 assert.Equal(
675 t,
676 "Edited item \"title\"\n",
677 stdout.String())
678}
679
680func TestRunItemEdit_NoChanges(t *testing.T) {
681 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