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

Function TestPRReopen_withComment

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

Source from the content-addressed store, hash-verified

109}
110
111func TestPRReopen_withComment(t *testing.T) {
112 http := &httpmock.Registry{}
113 defer http.Verify(t)
114
115 shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{
116 ID: "THE-ID",
117 Number: 123,
118 State: "CLOSED",
119 Title: "The title of the PR",
120 }, ghrepo.New("OWNER", "REPO"))
121
122 http.Register(
123 httpmock.GraphQL(`mutation CommentCreate\b`),
124 httpmock.GraphQLMutation(`
125 { "data": { "addComment": { "commentEdge": { "node": {
126 "url": "https://github.com/OWNER/REPO/issues/123#issuecomment-456"
127 } } } } }`,
128 func(inputs map[string]interface{}) {
129 assert.Equal(t, "THE-ID", inputs["subjectId"])
130 assert.Equal(t, "reopening comment", inputs["body"])
131 }),
132 )
133 http.Register(
134 httpmock.GraphQL(`mutation PullRequestReopen\b`),
135 httpmock.GraphQLMutation(`{"id": "THE-ID"}`,
136 func(inputs map[string]interface{}) {
137 assert.Equal(t, inputs["pullRequestId"], "THE-ID")
138 }),
139 )
140
141 output, err := runCommand(http, true, "123 --comment 'reopening comment'")
142 assert.NoError(t, err)
143 assert.Equal(t, "", output.String())
144 assert.Equal(t, "✓ Reopened pull request OWNER/REPO#123 (The title of the PR)\n", output.Stderr())
145}

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