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

Function TestPRStatus_currentBranch_Merged

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

Source from the content-addressed store, hash-verified

317}
318
319func 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
344func TestPRStatus_currentBranch_Merged_defaultBranch(t *testing.T) {
345 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