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

Function TestPRStatus_currentBranch_Merged_defaultBranch

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

Source from the content-addressed store, hash-verified

342}
343
344func TestPRStatus_currentBranch_Merged_defaultBranch(t *testing.T) {
345 http := initFakeHTTP()
346 defer http.Verify(t)
347 http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.FileResponse("./fixtures/prStatusCurrentBranchMergedOnDefaultBranch.json"))
348
349 // stub successful git command
350 rs, cleanup := run.Stub()
351 defer cleanup(t)
352 rs.Register(`git config --get-regexp \^branch\\.`, 0, "")
353 rs.Register(`git config remote.pushDefault`, 0, "")
354 rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "")
355 rs.Register(`git config push.default`, 1, "")
356
357 output, err := runCommand(http, "blueberries", true, "")
358 if err != nil {
359 t.Errorf("error running command `pr status`: %v", err)
360 }
361
362 expectedLine := regexp.MustCompile(`There is no pull request associated with \[blueberries\]`)
363 if !expectedLine.MatchString(output.String()) {
364 t.Errorf("output did not match regexp /%s/\n> output\n%s\n", expectedLine, output)
365 return
366 }
367}
368
369func TestPRStatus_blankSlate(t *testing.T) {
370 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