(t *testing.T)
| 292 | } |
| 293 | |
| 294 | func TestPRStatus_currentBranch_Closed_defaultBranch(t *testing.T) { |
| 295 | http := initFakeHTTP() |
| 296 | defer http.Verify(t) |
| 297 | http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.FileResponse("./fixtures/prStatusCurrentBranchClosedOnDefaultBranch.json")) |
| 298 | |
| 299 | // stub successful git command |
| 300 | rs, cleanup := run.Stub() |
| 301 | defer cleanup(t) |
| 302 | rs.Register(`git config --get-regexp \^branch\\.`, 0, "") |
| 303 | rs.Register(`git config remote.pushDefault`, 0, "") |
| 304 | rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "") |
| 305 | rs.Register(`git config push.default`, 1, "") |
| 306 | |
| 307 | output, err := runCommand(http, "blueberries", true, "") |
| 308 | if err != nil { |
| 309 | t.Errorf("error running command `pr status`: %v", err) |
| 310 | } |
| 311 | |
| 312 | expectedLine := regexp.MustCompile(`There is no pull request associated with \[blueberries\]`) |
| 313 | if !expectedLine.MatchString(output.String()) { |
| 314 | t.Errorf("output did not match regexp /%s/\n> output\n%s\n", expectedLine, output) |
| 315 | return |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | func TestPRStatus_currentBranch_Merged(t *testing.T) { |
| 320 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected