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

Function TestRunItemEdit_Number

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

Source from the content-addressed store, hash-verified

486}
487
488func TestRunItemEdit_Number(t *testing.T) {
489 defer gock.Off()
490 // gock.Observe(gock.DumpRequest)
491
492 // edit item
493 gock.New("https://api.github.com").
494 Post("/graphql").
495 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"number":123.45}}}}`).
496 Reply(200).
497 JSON(map[string]any{
498 "data": map[string]any{
499 "updateProjectV2ItemFieldValue": map[string]any{
500 "projectV2Item": map[string]any{
501 "ID": "item_id",
502 "content": map[string]any{
503 "__typename": "Issue",
504 "body": "body",
505 "title": "title",
506 "number": 1,
507 "repository": map[string]any{
508 "nameWithOwner": "my-repo",
509 },
510 },
511 },
512 },
513 },
514 })
515
516 client := queries.NewTestClient()
517
518 ios, _, stdout, _ := iostreams.Test()
519 ios.SetStdoutTTY(true)
520
521 config := editItemConfig{
522 io: ios,
523 opts: editItemOpts{
524 number: 123.45,
525 numberChanged: true,
526 itemID: "item_id",
527 projectID: "project_id",
528 fieldID: "field_id",
529 },
530 client: client,
531 }
532
533 err := runEditItem(config)
534 assert.NoError(t, err)
535 assert.Equal(
536 t,
537 "Edited item \"title\"\n",
538 stdout.String())
539}
540
541func TestRunItemEdit_NumberZero(t *testing.T) {
542 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