(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestPRReopen(t *testing.T) { |
| 53 | http := &httpmock.Registry{} |
| 54 | defer http.Verify(t) |
| 55 | |
| 56 | shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{ |
| 57 | ID: "THE-ID", |
| 58 | Number: 123, |
| 59 | State: "CLOSED", |
| 60 | Title: "The title of the PR", |
| 61 | }, ghrepo.New("OWNER", "REPO")) |
| 62 | |
| 63 | http.Register( |
| 64 | httpmock.GraphQL(`mutation PullRequestReopen\b`), |
| 65 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 66 | func(inputs map[string]interface{}) { |
| 67 | assert.Equal(t, inputs["pullRequestId"], "THE-ID") |
| 68 | }), |
| 69 | ) |
| 70 | |
| 71 | output, err := runCommand(http, true, "123") |
| 72 | assert.NoError(t, err) |
| 73 | assert.Equal(t, "", output.String()) |
| 74 | assert.Equal(t, "✓ Reopened pull request OWNER/REPO#123 (The title of the PR)\n", output.Stderr()) |
| 75 | } |
| 76 | |
| 77 | func TestPRReopen_alreadyOpen(t *testing.T) { |
| 78 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected