(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func TestPRReopen_withComment(t *testing.T) { |
| 112 | http := &httpmock.Registry{} |
| 113 | defer http.Verify(t) |
| 114 | |
| 115 | shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{ |
| 116 | ID: "THE-ID", |
| 117 | Number: 123, |
| 118 | State: "CLOSED", |
| 119 | Title: "The title of the PR", |
| 120 | }, ghrepo.New("OWNER", "REPO")) |
| 121 | |
| 122 | http.Register( |
| 123 | httpmock.GraphQL(`mutation CommentCreate\b`), |
| 124 | httpmock.GraphQLMutation(` |
| 125 | { "data": { "addComment": { "commentEdge": { "node": { |
| 126 | "url": "https://github.com/OWNER/REPO/issues/123#issuecomment-456" |
| 127 | } } } } }`, |
| 128 | func(inputs map[string]interface{}) { |
| 129 | assert.Equal(t, "THE-ID", inputs["subjectId"]) |
| 130 | assert.Equal(t, "reopening comment", inputs["body"]) |
| 131 | }), |
| 132 | ) |
| 133 | http.Register( |
| 134 | httpmock.GraphQL(`mutation PullRequestReopen\b`), |
| 135 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 136 | func(inputs map[string]interface{}) { |
| 137 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 138 | }), |
| 139 | ) |
| 140 | |
| 141 | output, err := runCommand(http, true, "123 --comment 'reopening comment'") |
| 142 | assert.NoError(t, err) |
| 143 | assert.Equal(t, "", output.String()) |
| 144 | assert.Equal(t, "✓ Reopened pull request OWNER/REPO#123 (The title of the PR)\n", output.Stderr()) |
| 145 | } |
nothing calls this directly
no test coverage detected