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

Function TestRunItemEdit_Date

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

Source from the content-addressed store, hash-verified

592}
593
594func TestRunItemEdit_Date(t *testing.T) {
595 defer gock.Off()
596 // gock.Observe(gock.DumpRequest)
597
598 // edit item
599 gock.New("https://api.github.com").
600 Post("/graphql").
601 BodyString(`{"query":"mutation UpdateItemValues.*","variables":{"input":{"projectId":"project_id","itemId":"item_id","fieldId":"field_id","value":{"date":"2023-01-01T00:00:00Z"}}}}`).
602 Reply(200).
603 JSON(map[string]any{
604 "data": map[string]any{
605 "updateProjectV2ItemFieldValue": map[string]any{
606 "projectV2Item": map[string]any{
607 "ID": "item_id",
608 "content": map[string]any{
609 "__typename": "Issue",
610 "body": "body",
611 "title": "title",
612 "number": 1,
613 "repository": map[string]any{
614 "nameWithOwner": "my-repo",
615 },
616 },
617 },
618 },
619 },
620 })
621
622 client := queries.NewTestClient()
623
624 ios, _, stdout, _ := iostreams.Test()
625 config := editItemConfig{
626 io: ios,
627 opts: editItemOpts{
628 date: "2023-01-01",
629 itemID: "item_id",
630 projectID: "project_id",
631 fieldID: "field_id",
632 },
633 client: client,
634 }
635
636 err := runEditItem(config)
637 assert.NoError(t, err)
638 assert.Equal(t, "", stdout.String())
639}
640
641func TestRunItemEdit_SingleSelect(t *testing.T) {
642 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.65

Tested by

no test coverage detected