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

Function TestPrAddToMergeQueueAdminWithMergeStrategy

pkg/cmd/pr/merge/merge_test.go:2075–2112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2073}
2074
2075func TestPrAddToMergeQueueAdminWithMergeStrategy(t *testing.T) {
2076 http := initFakeHTTP()
2077 defer http.Verify(t)
2078
2079 shared.StubFinderForRunCommandStyleTests(t,
2080 "1",
2081 &api.PullRequest{
2082 ID: "THE-ID",
2083 Number: 1,
2084 State: "OPEN",
2085 Title: "The title of the PR",
2086 MergeStateStatus: "CLEAN",
2087 IsInMergeQueue: false,
2088 },
2089 baseRepo("OWNER", "REPO", "main"),
2090 )
2091
2092 http.Register(
2093 httpmock.GraphQL(`mutation PullRequestMerge\b`),
2094 httpmock.GraphQLMutation(`{}`, func(input map[string]any) {
2095 assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
2096 assert.Equal(t, "MERGE", input["mergeMethod"].(string))
2097 assert.NotContains(t, input, "commitHeadline")
2098 }),
2099 )
2100
2101 cs, cmdTeardown := run.Stub()
2102 defer cmdTeardown(t)
2103 cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
2104
2105 output, err := runCommand(http, nil, "blueberries", true, "pr merge 1 --admin --merge")
2106 if err != nil {
2107 t.Fatalf("error running command `pr merge`: %v", err)
2108 }
2109
2110 assert.Equal(t, "", output.String())
2111 assert.Equal(t, "✓ Merged pull request OWNER/REPO#1 (The title of the PR)\n", output.Stderr())
2112}
2113
2114func TestPrMerge_deleteBranch_worktrees(t *testing.T) {
2115 type stub struct {

Callers

nothing calls this directly

Calls 12

GraphQLFunction · 0.92
GraphQLMutationFunction · 0.92
StubFunction · 0.92
baseRepoFunction · 0.85
EqualMethod · 0.80
StderrMethod · 0.80
initFakeHTTPFunction · 0.70
runCommandFunction · 0.70
VerifyMethod · 0.65
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected