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

Function TestPRCheckout_force

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

Source from the content-addressed store, hash-verified

1143}
1144
1145func TestPRCheckout_force(t *testing.T) {
1146 http := &httpmock.Registry{}
1147
1148 baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
1149 shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
1150
1151 cs, cmdTeardown := run.Stub()
1152 defer cmdTeardown(t)
1153 cs.Register(`git fetch origin \+refs/heads/feature:refs/remotes/origin/feature --no-tags`, 0, "")
1154 cs.Register(`git rev-parse --verify refs/heads/feature`, 0, "")
1155 cs.Register(`git checkout feature`, 0, "")
1156 cs.Register(`git reset --hard refs/remotes/origin/feature`, 0, "")
1157
1158 output, err := runCommand(http, nil, "master", `123 --force`, baseRepo)
1159
1160 assert.NoError(t, err)
1161 assert.Equal(t, "", output.String())
1162 assert.Equal(t, "", output.Stderr())
1163}
1164
1165func TestPRCheckout_detach(t *testing.T) {
1166 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
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected