(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestPRRevert_notRevertable(t *testing.T) { |
| 127 | http := &httpmock.Registry{} |
| 128 | defer http.Verify(t) |
| 129 | |
| 130 | shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{ |
| 131 | ID: "SOME-ID", |
| 132 | Number: 123, |
| 133 | State: "OPEN", |
| 134 | Title: "The title of the PR", |
| 135 | }, ghrepo.New("OWNER", "REPO")) |
| 136 | |
| 137 | // Target PR is not merged. |
| 138 | output, err := runCommand(http, true, "123") |
| 139 | // API error, non-zero exit. |
| 140 | assert.EqualError(t, err, "SilentError") |
| 141 | assert.Equal(t, "X Pull request OWNER/REPO#123 (The title of the PR) can't be reverted because it has not been merged\n", output.Stderr()) |
| 142 | // No URL printed. |
| 143 | assert.Equal(t, "", output.String()) |
| 144 | } |
| 145 | |
| 146 | func TestPRRevert_withTitleAndBody(t *testing.T) { |
| 147 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected