MCPcopy
hub / github.com/cli/cli / TestPRCheckout_force

Function TestPRCheckout_force

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

Source from the content-addressed store, hash-verified

750}
751
752func TestPRCheckout_force(t *testing.T) {
753 http := &httpmock.Registry{}
754
755 baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
756 shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
757
758 cs, cmdTeardown := run.Stub()
759 defer cmdTeardown(t)
760 cs.Register(`git fetch origin \+refs/heads/feature:refs/remotes/origin/feature --no-tags`, 0, "")
761 cs.Register(`git show-ref --verify -- refs/heads/feature`, 0, "")
762 cs.Register(`git checkout feature`, 0, "")
763 cs.Register(`git reset --hard refs/remotes/origin/feature`, 0, "")
764
765 output, err := runCommand(http, nil, "master", `123 --force`, baseRepo)
766
767 assert.NoError(t, err)
768 assert.Equal(t, "", output.String())
769 assert.Equal(t, "", output.Stderr())
770}
771
772func TestPRCheckout_detach(t *testing.T) {
773 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 8

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