MCPcopy Index your code
hub / github.com/cli/cli / TestPRReopen

Function TestPRReopen

pkg/cmd/pr/reopen/reopen_test.go:52–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func 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
77func TestPRReopen_alreadyOpen(t *testing.T) {
78 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
RegisterMethod · 0.95
NewFunction · 0.92
GraphQLFunction · 0.92
GraphQLMutationFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
runCommandFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected