(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func TestPRReadyUndo(t *testing.T) { |
| 166 | http := &httpmock.Registry{} |
| 167 | defer http.Verify(t) |
| 168 | |
| 169 | shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{ |
| 170 | ID: "THE-ID", |
| 171 | Number: 123, |
| 172 | State: "OPEN", |
| 173 | IsDraft: false, |
| 174 | }, ghrepo.New("OWNER", "REPO")) |
| 175 | |
| 176 | http.Register( |
| 177 | httpmock.GraphQL(`mutation ConvertPullRequestToDraft\b`), |
| 178 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 179 | func(inputs map[string]interface{}) { |
| 180 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 181 | }), |
| 182 | ) |
| 183 | |
| 184 | output, err := runCommand(http, true, "123 --undo") |
| 185 | assert.NoError(t, err) |
| 186 | assert.Equal(t, "", output.String()) |
| 187 | assert.Equal(t, "✓ Pull request OWNER/REPO#123 is converted to \"draft\"\n", output.Stderr()) |
| 188 | } |
| 189 | |
| 190 | func TestPRReadyUndo_alreadyDraft(t *testing.T) { |
| 191 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected