(t *testing.T)
| 317 | } |
| 318 | |
| 319 | func TestPRStatus_currentBranch_Merged(t *testing.T) { |
| 320 | http := initFakeHTTP() |
| 321 | defer http.Verify(t) |
| 322 | http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.FileResponse("./fixtures/prStatusCurrentBranchMerged.json")) |
| 323 | |
| 324 | // stub successful git command |
| 325 | rs, cleanup := run.Stub() |
| 326 | defer cleanup(t) |
| 327 | rs.Register(`git config --get-regexp \^branch\\.`, 0, "") |
| 328 | rs.Register(`git config remote.pushDefault`, 0, "") |
| 329 | rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "") |
| 330 | rs.Register(`git config push.default`, 1, "") |
| 331 | |
| 332 | output, err := runCommand(http, "blueberries", true, "") |
| 333 | if err != nil { |
| 334 | t.Errorf("error running command `pr status`: %v", err) |
| 335 | } |
| 336 | |
| 337 | expectedLine := regexp.MustCompile(`#8 Blueberries are a good fruit \[blueberries\] - Merged`) |
| 338 | if !expectedLine.MatchString(output.String()) { |
| 339 | t.Errorf("output did not match regexp /%s/\n> output\n%s\n", expectedLine, output) |
| 340 | return |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | func TestPRStatus_currentBranch_Merged_defaultBranch(t *testing.T) { |
| 345 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected