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

Function TestPRReady

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

Source from the content-addressed store, hash-verified

121}
122
123func TestPRReady(t *testing.T) {
124 http := &httpmock.Registry{}
125 defer http.Verify(t)
126
127 shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{
128 ID: "THE-ID",
129 Number: 123,
130 State: "OPEN",
131 IsDraft: true,
132 }, ghrepo.New("OWNER", "REPO"))
133
134 http.Register(
135 httpmock.GraphQL(`mutation PullRequestReadyForReview\b`),
136 httpmock.GraphQLMutation(`{"id": "THE-ID"}`,
137 func(inputs map[string]interface{}) {
138 assert.Equal(t, inputs["pullRequestId"], "THE-ID")
139 }),
140 )
141
142 output, err := runCommand(http, true, "123")
143 assert.NoError(t, err)
144 assert.Equal(t, "", output.String())
145 assert.Equal(t, "✓ Pull request OWNER/REPO#123 is marked as \"ready for review\"\n", output.Stderr())
146}
147
148func TestPRReady_alreadyReady(t *testing.T) {
149 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