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

Function Test_pullRequestWithoutCommits

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

Source from the content-addressed store, hash-verified

1134}
1135
1136func Test_pullRequestWithoutCommits(t *testing.T) {
1137 http := initFakeHTTP()
1138 defer http.Verify(t)
1139
1140 shared.StubFinderForRunCommandStyleTests(t,
1141 "",
1142 &api.PullRequest{
1143 ID: "PR_10",
1144 Number: 10,
1145 Title: "Blueberries are a good fruit",
1146 State: "OPEN",
1147 MergeStateStatus: "CLEAN",
1148 },
1149 baseRepo("OWNER", "REPO", "main"),
1150 )
1151
1152 http.Register(
1153 httpmock.GraphQL(`mutation PullRequestMerge\b`),
1154 httpmock.GraphQLMutation(`{}`, func(input map[string]any) {
1155 assert.Equal(t, "PR_10", input["pullRequestId"].(string))
1156 assert.Equal(t, "MERGE", input["mergeMethod"].(string))
1157 assert.NotContains(t, input, "commitHeadline")
1158 }))
1159
1160 cs, cmdTeardown := run.Stub()
1161 defer cmdTeardown(t)
1162
1163 cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
1164
1165 output, err := runCommand(http, nil, "blueberries", true, "pr merge --merge")
1166 if err != nil {
1167 t.Fatalf("error running command `pr merge`: %v", err)
1168 }
1169
1170 assert.Equal(t, heredoc.Doc(`
1171 ✓ Merged pull request OWNER/REPO#10 (Blueberries are a good fruit)
1172 `), output.Stderr())
1173}
1174
1175func TestPrMerge_rebase(t *testing.T) {
1176 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 11

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
RegisterMethod · 0.45

Tested by

no test coverage detected