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

Function TestPRStatus_currentBranch_defaultBranch

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

Source from the content-addressed store, hash-verified

225}
226
227func TestPRStatus_currentBranch_defaultBranch(t *testing.T) {
228 http := initFakeHTTP()
229 defer http.Verify(t)
230 http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.FileResponse("./fixtures/prStatusCurrentBranch.json"))
231
232 // stub successful git command
233 rs, cleanup := run.Stub()
234 defer cleanup(t)
235 rs.Register(`git config --get-regexp \^branch\\.`, 0, "")
236 rs.Register(`git config remote.pushDefault`, 0, "")
237 rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "")
238 rs.Register(`git config push.default`, 1, "")
239
240 output, err := runCommand(http, "blueberries", true, "")
241 if err != nil {
242 t.Errorf("error running command `pr status`: %v", err)
243 }
244
245 expectedLine := regexp.MustCompile(`#10 Blueberries are certainly a good fruit \[blueberries\]`)
246 if !expectedLine.MatchString(output.String()) {
247 t.Errorf("output did not match regexp /%s/\n> output\n%s\n", expectedLine, output)
248 return
249 }
250}
251
252func TestPRStatus_currentBranch_defaultBranch_repoFlag(t *testing.T) {
253 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