MCPcopy Index your code
hub / github.com/cli/cli / TestRunItemEdit_SingleSelect

Function TestRunItemEdit_SingleSelect

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

Source from the content-addressed store, hash-verified

579}
580
581func TestRunItemEdit_SingleSelect(t *testing.T) {
582 defer gock.Off()
583 // gock.Observe(gock.DumpRequest)
584
585 // edit item
586 gock.New("https://api.github.com").
587 Post("/graphql").
588 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"singleSelectOptionId":"option_id"}}}}`).
589 Reply(200).
590 JSON(map[string]interface{}{
591 "data": map[string]interface{}{
592 "updateProjectV2ItemFieldValue": map[string]interface{}{
593 "projectV2Item": map[string]interface{}{
594 "ID": "item_id",
595 "content": map[string]interface{}{
596 "__typename": "Issue",
597 "body": "body",
598 "title": "title",
599 "number": 1,
600 "repository": map[string]interface{}{
601 "nameWithOwner": "my-repo",
602 },
603 },
604 },
605 },
606 },
607 })
608
609 client := queries.NewTestClient()
610
611 ios, _, stdout, _ := iostreams.Test()
612 config := editItemConfig{
613 io: ios,
614 opts: editItemOpts{
615 singleSelectOptionID: "option_id",
616 itemID: "item_id",
617 projectID: "project_id",
618 fieldID: "field_id",
619 },
620 client: client,
621 }
622
623 err := runEditItem(config)
624 assert.NoError(t, err)
625 assert.Equal(t, "", stdout.String())
626}
627
628func TestRunItemEdit_Iteration(t *testing.T) {
629 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.45

Tested by

no test coverage detected