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

Function TestRunDeleteField

pkg/cmd/project/field-delete/field_delete_test.go:79–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestRunDeleteField(t *testing.T) {
80 defer gock.Off()
81 gock.Observe(gock.DumpRequest)
82
83 // delete Field
84 gock.New("https://api.github.com").
85 Post("/graphql").
86 BodyString(`{"query":"mutation DeleteField.*","variables":{"input":{"fieldId":"an ID"}}}`).
87 Reply(200).
88 JSON(map[string]interface{}{
89 "data": map[string]interface{}{
90 "deleteProjectV2Field": map[string]interface{}{
91 "projectV2Field": map[string]interface{}{
92 "id": "Field ID",
93 },
94 },
95 },
96 })
97
98 client := queries.NewTestClient()
99
100 ios, _, stdout, _ := iostreams.Test()
101 ios.SetStdoutTTY(true)
102 config := deleteFieldConfig{
103 opts: deleteFieldOpts{
104 fieldID: "an ID",
105 },
106 client: client,
107 io: ios,
108 }
109
110 err := runDeleteField(config)
111 assert.NoError(t, err)
112 assert.Equal(
113 t,
114 "Deleted field\n",
115 stdout.String())
116}
117
118func TestRunDeleteField_JSON(t *testing.T) {
119 defer gock.Off()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected