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

Function TestRunItemEdit_Draft

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

Source from the content-addressed store, hash-verified

247}
248
249func TestRunItemEdit_Draft(t *testing.T) {
250 defer gock.Off()
251 // gock.Observe(gock.DumpRequest)
252
253 // edit item
254 gock.New("https://api.github.com").
255 Post("/graphql").
256 BodyString(`{"query":"mutation EditDraftIssueItem.*","variables":{"input":{"draftIssueId":"DI_item_id","title":"a title","body":"a new body"}}}`).
257 Reply(200).
258 JSON(map[string]any{
259 "data": map[string]any{
260 "updateProjectV2DraftIssue": map[string]any{
261 "draftIssue": map[string]any{
262 "title": "a title",
263 "body": "a new body",
264 },
265 },
266 },
267 })
268
269 client := queries.NewTestClient()
270
271 ios, _, stdout, _ := iostreams.Test()
272 ios.SetStdoutTTY(true)
273
274 config := editItemConfig{
275 io: ios,
276 opts: editItemOpts{
277 title: "a title",
278 titleChanged: true,
279 body: "a new body",
280 bodyChanged: true,
281 itemID: "DI_item_id",
282 },
283 client: client,
284 }
285
286 err := runEditItem(config)
287 assert.NoError(t, err)
288 assert.Equal(
289 t,
290 "Edited draft issue \"a title\"\n",
291 stdout.String())
292}
293
294func TestRunItemEdit_DraftTitleOnly(t *testing.T) {
295 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