MCPcopy
hub / github.com/cli/cli / TestIssueDelete_confirm

Function TestIssueDelete_confirm

pkg/cmd/issue/delete/delete_test.go:102–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestIssueDelete_confirm(t *testing.T) {
103 httpRegistry := &httpmock.Registry{}
104 defer httpRegistry.Verify(t)
105
106 httpRegistry.Register(
107 httpmock.GraphQL(`query IssueByNumber\b`),
108 httpmock.StringResponse(`
109 { "data": { "repository": {
110 "hasIssuesEnabled": true,
111 "issue": { "id": "THE-ID", "number": 13, "title": "The title of the issue"}
112 } } }`),
113 )
114 httpRegistry.Register(
115 httpmock.GraphQL(`mutation IssueDelete\b`),
116 httpmock.GraphQLMutation(`{"id": "THE-ID"}`,
117 func(inputs map[string]interface{}) {
118 assert.Equal(t, inputs["issueId"], "THE-ID")
119 }),
120 )
121
122 output, err := runCommand(httpRegistry, nil, true, "13 --confirm")
123 if err != nil {
124 t.Fatalf("error running command `issue delete`: %v", err)
125 }
126
127 r := regexp.MustCompile(`Deleted issue OWNER/REPO#13 \(The title of the issue\)`)
128
129 if !r.MatchString(output.Stderr()) {
130 t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr())
131 }
132}
133
134func TestIssueDelete_cancel(t *testing.T) {
135 httpRegistry := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
runCommandFunction · 0.70

Tested by

no test coverage detected