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

Function TestRunDeleteField_JSON

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

Source from the content-addressed store, hash-verified

116}
117
118func TestRunDeleteField_JSON(t *testing.T) {
119 defer gock.Off()
120 gock.Observe(gock.DumpRequest)
121
122 // delete Field
123 gock.New("https://api.github.com").
124 Post("/graphql").
125 BodyString(`{"query":"mutation DeleteField.*","variables":{"input":{"fieldId":"an ID"}}}`).
126 Reply(200).
127 JSON(map[string]interface{}{
128 "data": map[string]interface{}{
129 "deleteProjectV2Field": map[string]interface{}{
130 "projectV2Field": map[string]interface{}{
131 "__typename": "ProjectV2Field",
132 "id": "Field ID",
133 "name": "a name",
134 },
135 },
136 },
137 })
138
139 client := queries.NewTestClient()
140
141 ios, _, stdout, _ := iostreams.Test()
142 config := deleteFieldConfig{
143 opts: deleteFieldOpts{
144 fieldID: "an ID",
145 exporter: cmdutil.NewJSONExporter(),
146 },
147 client: client,
148 io: ios,
149 }
150
151 err := runDeleteField(config)
152 assert.NoError(t, err)
153 assert.JSONEq(
154 t,
155 `{"id":"Field ID","name":"a name","type":"ProjectV2Field"}`,
156 stdout.String())
157}

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
NewJSONExporterFunction · 0.92
runDeleteFieldFunction · 0.85
ReplyMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected