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

Function TestRunItemEdit_Iteration

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

Source from the content-addressed store, hash-verified

686}
687
688func TestRunItemEdit_Iteration(t *testing.T) {
689 defer gock.Off()
690 // gock.Observe(gock.DumpRequest)
691
692 // edit item
693 gock.New("https://api.github.com").
694 Post("/graphql").
695 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"iterationId":"option_id"}}}}`).
696 Reply(200).
697 JSON(map[string]any{
698 "data": map[string]any{
699 "updateProjectV2ItemFieldValue": map[string]any{
700 "projectV2Item": map[string]any{
701 "ID": "item_id",
702 "content": map[string]any{
703 "__typename": "Issue",
704 "body": "body",
705 "title": "title",
706 "number": 1,
707 "repository": map[string]any{
708 "nameWithOwner": "my-repo",
709 },
710 },
711 },
712 },
713 },
714 })
715
716 client := queries.NewTestClient()
717
718 ios, _, stdout, _ := iostreams.Test()
719 ios.SetStdoutTTY(true)
720
721 config := editItemConfig{
722 io: ios,
723 opts: editItemOpts{
724 iterationID: "option_id",
725 itemID: "item_id",
726 projectID: "project_id",
727 fieldID: "field_id",
728 },
729 client: client,
730 }
731
732 err := runEditItem(config)
733 assert.NoError(t, err)
734 assert.Equal(
735 t,
736 "Edited item \"title\"\n",
737 stdout.String())
738}
739
740func TestRunItemEdit_NoChanges(t *testing.T) {
741 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