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

Function TestPRCheckout_differentRepoForce

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

Source from the content-addressed store, hash-verified

1004}
1005
1006func TestPRCheckout_differentRepoForce(t *testing.T) {
1007 http := &httpmock.Registry{}
1008 defer http.Verify(t)
1009
1010 baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
1011 finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
1012 finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})
1013
1014 cs, cmdTeardown := run.Stub()
1015 defer cmdTeardown(t)
1016 cs.Register(`git fetch origin refs/pull/123/head:feature --no-tags --force`, 0, "")
1017 cs.Register(`git config branch\.feature\.merge`, 1, "")
1018 cs.Register(`git checkout feature`, 0, "")
1019 cs.Register(`git config branch\.feature\.remote origin`, 0, "")
1020 cs.Register(`git config branch\.feature\.pushRemote origin`, 0, "")
1021 cs.Register(`git config branch\.feature\.merge refs/pull/123/head`, 0, "")
1022
1023 output, err := runCommand(http, nil, "master", `123 --force`, baseRepo)
1024 assert.NoError(t, err)
1025 assert.Equal(t, "", output.String())
1026 assert.Equal(t, "", output.Stderr())
1027}
1028
1029func TestPRCheckout_differentRepo_existingBranch(t *testing.T) {
1030 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
StubFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
stubPRFunction · 0.70
runCommandFunction · 0.70
StringMethod · 0.65
ExpectFieldsMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected