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

Function TestPRCheckout_existingBranch

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

Source from the content-addressed store, hash-verified

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