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

Function TestPRStatus_currentBranch_Closed

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

Source from the content-addressed store, hash-verified

267}
268
269func TestPRStatus_currentBranch_Closed(t *testing.T) {
270 http := initFakeHTTP()
271 defer http.Verify(t)
272 http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.FileResponse("./fixtures/prStatusCurrentBranchClosed.json"))
273
274 // stub successful git command
275 rs, cleanup := run.Stub()
276 defer cleanup(t)
277 rs.Register(`git config --get-regexp \^branch\\.`, 0, "")
278 rs.Register(`git config remote.pushDefault`, 0, "")
279 rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "")
280 rs.Register(`git config push.default`, 1, "")
281
282 output, err := runCommand(http, "blueberries", true, "")
283 if err != nil {
284 t.Errorf("error running command `pr status`: %v", err)
285 }
286
287 expectedLine := regexp.MustCompile(`#8 Blueberries are a good fruit \[blueberries\] - Closed`)
288 if !expectedLine.MatchString(output.String()) {
289 t.Errorf("output did not match regexp /%s/\n> output\n%s\n", expectedLine, output)
290 return
291 }
292}
293
294func TestPRStatus_currentBranch_Closed_defaultBranch(t *testing.T) {
295 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