MCPcopy
hub / github.com/cli/cli / TestIssueDelete_cancel

Function TestIssueDelete_cancel

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

Source from the content-addressed store, hash-verified

132}
133
134func TestIssueDelete_cancel(t *testing.T) {
135 httpRegistry := &httpmock.Registry{}
136 defer httpRegistry.Verify(t)
137
138 httpRegistry.Register(
139 httpmock.GraphQL(`query IssueByNumber\b`),
140 httpmock.StringResponse(`
141 { "data": { "repository": {
142 "hasIssuesEnabled": true,
143 "issue": { "id": "THE-ID", "number": 13, "title": "The title of the issue"}
144 } } }`),
145 )
146
147 pm := prompter.NewMockPrompter(t)
148 pm.RegisterConfirmDeletion("13", func(_ string) error {
149 return errors.New("You entered 14")
150 })
151
152 _, err := runCommand(httpRegistry, pm, true, "13")
153 if err == nil {
154 t.Fatalf("expected error")
155 }
156 if err.Error() != "You entered 14" {
157 t.Fatalf("got unexpected error '%s'", err)
158 }
159}
160
161func TestIssueDelete_doesNotExist(t *testing.T) {
162 httpRegistry := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewMockPrompterFunction · 0.92
runCommandFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected