(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestIssueReopen(t *testing.T) { |
| 66 | http := &httpmock.Registry{} |
| 67 | defer http.Verify(t) |
| 68 | |
| 69 | http.Register( |
| 70 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 71 | httpmock.StringResponse(` |
| 72 | { "data": { "repository": { |
| 73 | "hasIssuesEnabled": true, |
| 74 | "issue": { "id": "THE-ID", "number": 2, "state": "CLOSED", "title": "The title of the issue"} |
| 75 | } } }`), |
| 76 | ) |
| 77 | http.Register( |
| 78 | httpmock.GraphQL(`mutation IssueReopen\b`), |
| 79 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 80 | func(inputs map[string]interface{}) { |
| 81 | assert.Equal(t, inputs["issueId"], "THE-ID") |
| 82 | }), |
| 83 | ) |
| 84 | |
| 85 | output, err := runCommand(http, true, "2") |
| 86 | if err != nil { |
| 87 | t.Fatalf("error running command `issue reopen`: %v", err) |
| 88 | } |
| 89 | |
| 90 | r := regexp.MustCompile(`Reopened issue OWNER/REPO#2 \(The title of the issue\)`) |
| 91 | |
| 92 | if !r.MatchString(output.Stderr()) { |
| 93 | t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr()) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func TestIssueReopen_alreadyOpen(t *testing.T) { |
| 98 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected