(t *testing.T)
| 1134 | } |
| 1135 | |
| 1136 | func 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 | |
| 1175 | func TestPrMerge_rebase(t *testing.T) { |
| 1176 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected