MCPcopy
hub / github.com/cli/cli / TestRunItemEdit_Text

Function TestRunItemEdit_Text

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

Source from the content-addressed store, hash-verified

380}
381
382func TestRunItemEdit_Text(t *testing.T) {
383 defer gock.Off()
384 // gock.Observe(gock.DumpRequest)
385
386 // edit item
387 gock.New("https://api.github.com").
388 Post("/graphql").
389 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"text":"item text"}}}}`).
390 Reply(200).
391 JSON(map[string]interface{}{
392 "data": map[string]interface{}{
393 "updateProjectV2ItemFieldValue": map[string]interface{}{
394 "projectV2Item": map[string]interface{}{
395 "ID": "item_id",
396 "content": map[string]interface{}{
397 "body": "body",
398 "title": "title",
399 "number": 1,
400 "repository": map[string]interface{}{
401 "nameWithOwner": "my-repo",
402 },
403 },
404 },
405 },
406 },
407 })
408
409 client := queries.NewTestClient()
410
411 ios, _, stdout, _ := iostreams.Test()
412 config := editItemConfig{
413 io: ios,
414 opts: editItemOpts{
415 text: "item text",
416 itemID: "item_id",
417 projectID: "project_id",
418 fieldID: "field_id",
419 },
420 client: client,
421 }
422
423 err := runEditItem(config)
424 assert.NoError(t, err)
425 assert.Equal(t, "", stdout.String())
426}
427
428func TestRunItemEdit_Number(t *testing.T) {
429 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