MCPcopy
hub / github.com/cli/cli / TestIssueReopen_alreadyOpen

Function TestIssueReopen_alreadyOpen

pkg/cmd/issue/reopen/reopen_test.go:97–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestIssueReopen_alreadyOpen(t *testing.T) {
98 http := &httpmock.Registry{}
99 defer http.Verify(t)
100
101 http.Register(
102 httpmock.GraphQL(`query IssueByNumber\b`),
103 httpmock.StringResponse(`
104 { "data": { "repository": {
105 "hasIssuesEnabled": true,
106 "issue": { "number": 2, "state": "OPEN", "title": "The title of the issue"}
107 } } }`),
108 )
109
110 output, err := runCommand(http, true, "2")
111 if err != nil {
112 t.Fatalf("error running command `issue reopen`: %v", err)
113 }
114
115 r := regexp.MustCompile(`Issue OWNER/REPO#2 \(The title of the issue\) is already open`)
116
117 if !r.MatchString(output.Stderr()) {
118 t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr())
119 }
120}
121
122func TestIssueReopen_issuesDisabled(t *testing.T) {
123 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected