(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestPrClose_deleteBranch_crossRepo(t *testing.T) { |
| 179 | http := &httpmock.Registry{} |
| 180 | defer http.Verify(t) |
| 181 | |
| 182 | baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:blueberries") |
| 183 | pr.Title = "The title of the PR" |
| 184 | shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo) |
| 185 | |
| 186 | http.Register( |
| 187 | httpmock.GraphQL(`mutation PullRequestClose\b`), |
| 188 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 189 | func(inputs map[string]interface{}) { |
| 190 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 191 | }), |
| 192 | ) |
| 193 | |
| 194 | cs, cmdTeardown := run.Stub() |
| 195 | defer cmdTeardown(t) |
| 196 | |
| 197 | cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "") |
| 198 | cs.Register(`git branch -D blueberries`, 0, "") |
| 199 | |
| 200 | output, err := runCommand(http, true, `96 --delete-branch`) |
| 201 | assert.NoError(t, err) |
| 202 | assert.Equal(t, "", output.String()) |
| 203 | assert.Equal(t, heredoc.Doc(` |
| 204 | ✓ Closed pull request OWNER/REPO#96 (The title of the PR) |
| 205 | ! Skipped deleting the remote branch of a pull request from fork |
| 206 | ✓ Deleted branch blueberries |
| 207 | `), output.Stderr()) |
| 208 | } |
| 209 | |
| 210 | func TestPrClose_deleteBranch_sameBranch(t *testing.T) { |
| 211 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected