MCPcopy Create free account
hub / github.com/cli/cli / TestPRStatus_currentBranch_Closed_defaultBranch

Function TestPRStatus_currentBranch_Closed_defaultBranch

pkg/cmd/pr/status/status_test.go:294–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func 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
319func TestPRStatus_currentBranch_Merged(t *testing.T) {
320 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 9

GraphQLFunction · 0.92
FileResponseFunction · 0.92
StubFunction · 0.92
initFakeHTTPFunction · 0.70
runCommandFunction · 0.70
VerifyMethod · 0.65
ErrorfMethod · 0.65
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected