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

Function TestPRCheckout_force

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

Source from the content-addressed store, hash-verified

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