(t *testing.T)
| 277 | } |
| 278 | |
| 279 | func TestPrClose_withComment(t *testing.T) { |
| 280 | http := &httpmock.Registry{} |
| 281 | defer http.Verify(t) |
| 282 | |
| 283 | baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature") |
| 284 | pr.Title = "The title of the PR" |
| 285 | shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo) |
| 286 | |
| 287 | http.Register( |
| 288 | httpmock.GraphQL(`mutation CommentCreate\b`), |
| 289 | httpmock.GraphQLMutation(` |
| 290 | { "data": { "addComment": { "commentEdge": { "node": { |
| 291 | "url": "https://github.com/OWNER/REPO/issues/123#issuecomment-456" |
| 292 | } } } } }`, |
| 293 | func(inputs map[string]interface{}) { |
| 294 | assert.Equal(t, "THE-ID", inputs["subjectId"]) |
| 295 | assert.Equal(t, "closing comment", inputs["body"]) |
| 296 | }), |
| 297 | ) |
| 298 | http.Register( |
| 299 | httpmock.GraphQL(`mutation PullRequestClose\b`), |
| 300 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 301 | func(inputs map[string]interface{}) { |
| 302 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 303 | }), |
| 304 | ) |
| 305 | |
| 306 | output, err := runCommand(http, true, "96 --comment 'closing comment'") |
| 307 | assert.NoError(t, err) |
| 308 | assert.Equal(t, "", output.String()) |
| 309 | assert.Equal(t, "✓ Closed pull request OWNER/REPO#96 (The title of the PR)\n", output.Stderr()) |
| 310 | } |
nothing calls this directly
no test coverage detected