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

Function TestPRCheckout_existingBranch

pkg/cmd/pr/checkout/checkout_test.go:930–948  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

928}
929
930func TestPRCheckout_existingBranch(t *testing.T) {
931 http := &httpmock.Registry{}
932 defer http.Verify(t)
933
934 baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
935 shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
936
937 cs, cmdTeardown := run.Stub()
938 defer cmdTeardown(t)
939 cs.Register(`git fetch origin \+refs/heads/feature:refs/remotes/origin/feature --no-tags`, 0, "")
940 cs.Register(`git rev-parse --verify refs/heads/feature`, 0, "")
941 cs.Register(`git checkout feature`, 0, "")
942 cs.Register(`git merge --ff-only refs/remotes/origin/feature`, 0, "")
943
944 output, err := runCommand(http, nil, "master", `123`, baseRepo)
945 assert.NoError(t, err)
946 assert.Equal(t, "", output.String())
947 assert.Equal(t, "", output.Stderr())
948}
949
950func TestPRCheckout_differentRepo_remoteExists(t *testing.T) {
951 remotes := context.Remotes{

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
StubFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
stubPRFunction · 0.70
runCommandFunction · 0.70
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected