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

Function TestPRStatus_blankSlate

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

Source from the content-addressed store, hash-verified

367}
368
369func TestPRStatus_blankSlate(t *testing.T) {
370 http := initFakeHTTP()
371 defer http.Verify(t)
372 http.Register(httpmock.GraphQL(`query PullRequestStatus\b`), httpmock.StringResponse(`{"data": {}}`))
373
374 // stub successful git command
375 rs, cleanup := run.Stub()
376 defer cleanup(t)
377 rs.Register(`git config --get-regexp \^branch\\.`, 0, "")
378 rs.Register(`git config remote.pushDefault`, 0, "")
379 rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "")
380 rs.Register(`git config push.default`, 1, "")
381
382 output, err := runCommand(http, "blueberries", true, "")
383 if err != nil {
384 t.Errorf("error running command `pr status`: %v", err)
385 }
386
387 expected := `
388Relevant pull requests in OWNER/REPO
389
390Current branch
391 There is no pull request associated with [blueberries]
392
393Created by you
394 You have no open pull requests
395
396Requesting a code review from you
397 You have no pull requests to review
398
399`
400 if output.String() != expected {
401 t.Errorf("expected %q, got %q", expected, output.String())
402 }
403}
404
405func TestPRStatus_blankSlateRepoOverride(t *testing.T) {
406 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 9

GraphQLFunction · 0.92
StringResponseFunction · 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