MCPcopy
hub / github.com/cli/cli / TestPRCheckout_existingBranch

Function TestPRCheckout_existingBranch

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

Source from the content-addressed store, hash-verified

535}
536
537func TestPRCheckout_existingBranch(t *testing.T) {
538 http := &httpmock.Registry{}
539 defer http.Verify(t)
540
541 baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
542 shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
543
544 cs, cmdTeardown := run.Stub()
545 defer cmdTeardown(t)
546 cs.Register(`git fetch origin \+refs/heads/feature:refs/remotes/origin/feature --no-tags`, 0, "")
547 cs.Register(`git show-ref --verify -- refs/heads/feature`, 0, "")
548 cs.Register(`git checkout feature`, 0, "")
549 cs.Register(`git merge --ff-only refs/remotes/origin/feature`, 0, "")
550
551 output, err := runCommand(http, nil, "master", `123`, baseRepo)
552 assert.NoError(t, err)
553 assert.Equal(t, "", output.String())
554 assert.Equal(t, "", output.Stderr())
555}
556
557func TestPRCheckout_differentRepo_remoteExists(t *testing.T) {
558 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
RegisterMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected