(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestPrClose_deleteBranch_sameRepo(t *testing.T) { |
| 145 | http := &httpmock.Registry{} |
| 146 | defer http.Verify(t) |
| 147 | |
| 148 | baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:blueberries") |
| 149 | pr.Title = "The title of the PR" |
| 150 | shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo) |
| 151 | |
| 152 | http.Register( |
| 153 | httpmock.GraphQL(`mutation PullRequestClose\b`), |
| 154 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 155 | func(inputs map[string]interface{}) { |
| 156 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 157 | }), |
| 158 | ) |
| 159 | http.Register( |
| 160 | httpmock.REST("DELETE", "repos/OWNER/REPO/git/refs/heads/blueberries"), |
| 161 | httpmock.StringResponse(`{}`)) |
| 162 | |
| 163 | cs, cmdTeardown := run.Stub() |
| 164 | defer cmdTeardown(t) |
| 165 | |
| 166 | cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "") |
| 167 | cs.Register(`git branch -D blueberries`, 0, "") |
| 168 | |
| 169 | output, err := runCommand(http, true, `96 --delete-branch`) |
| 170 | assert.NoError(t, err) |
| 171 | assert.Equal(t, "", output.String()) |
| 172 | assert.Equal(t, heredoc.Doc(` |
| 173 | ✓ Closed pull request OWNER/REPO#96 (The title of the PR) |
| 174 | ✓ Deleted branch blueberries |
| 175 | `), output.Stderr()) |
| 176 | } |
| 177 | |
| 178 | func TestPrClose_deleteBranch_crossRepo(t *testing.T) { |
| 179 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected