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

Function TestPRReadyUndo

pkg/cmd/pr/ready/ready_test.go:165–188  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func 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
190func TestPRReadyUndo_alreadyDraft(t *testing.T) {
191 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