(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestPRRevert_withTitleAndBody(t *testing.T) { |
| 147 | http := &httpmock.Registry{} |
| 148 | defer http.Verify(t) |
| 149 | |
| 150 | shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{ |
| 151 | ID: "SOME-ID", |
| 152 | Number: 123, |
| 153 | State: "MERGED", |
| 154 | Title: "The title of the PR", |
| 155 | }, ghrepo.New("OWNER", "REPO")) |
| 156 | |
| 157 | http.Register( |
| 158 | httpmock.GraphQL(`mutation PullRequestRevert\b`), |
| 159 | httpmock.GraphQLMutation(` |
| 160 | { "data": { "revertPullRequest": { "pullRequest": { |
| 161 | "ID": "SOME-ID" |
| 162 | }, "revertPullRequest": { |
| 163 | "ID": "NEW-ID", |
| 164 | "Number": 456, |
| 165 | "URL": "https://github.com/OWNER/REPO/pull/456" |
| 166 | } } } } |
| 167 | `, |
| 168 | func(inputs map[string]interface{}) { |
| 169 | assert.Equal(t, inputs["pullRequestId"], "SOME-ID") |
| 170 | assert.Equal(t, inputs["title"], "Revert PR title") |
| 171 | assert.Equal(t, inputs["body"], "Revert PR body") |
| 172 | }), |
| 173 | ) |
| 174 | |
| 175 | output, err := runCommand(http, true, "123 --title 'Revert PR title' --body 'Revert PR body'") |
| 176 | // Revert PR created. |
| 177 | assert.NoError(t, err) |
| 178 | // Only URL printed. |
| 179 | assert.Equal(t, "https://github.com/OWNER/REPO/pull/456\n", output.String()) |
| 180 | assert.Equal(t, "", output.Stderr()) |
| 181 | } |
| 182 | |
| 183 | func TestPRRevert_withDraft(t *testing.T) { |
| 184 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected