MCPcopy
hub / github.com/cli/cli / Test_transferRunSuccessfulIssueTransfer

Function Test_transferRunSuccessfulIssueTransfer

pkg/cmd/issue/transfer/transfer_test.go:159–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func Test_transferRunSuccessfulIssueTransfer(t *testing.T) {
160 http := &httpmock.Registry{}
161 defer http.Verify(t)
162
163 http.Register(
164 httpmock.GraphQL(`query IssueByNumber\b`),
165 httpmock.StringResponse(`
166 { "data": { "repository": {
167 "hasIssuesEnabled": true,
168 "issue": { "id": "THE-ID", "number": 1234, "title": "The title of the issue"}
169 } } }`))
170
171 http.Register(
172 httpmock.GraphQL(`query IssueRepositoryInfo\b`),
173 httpmock.StringResponse(`
174 { "data": { "repository": {
175 "id": "dest-id",
176 "name": "REPO1",
177 "owner": { "login": "OWNER1" },
178 "viewerPermission": "WRITE",
179 "hasIssuesEnabled": true
180 }}}`))
181
182 http.Register(
183 httpmock.GraphQL(`mutation IssueTransfer\b`),
184 httpmock.GraphQLMutation(`{"data":{"transferIssue":{"issue":{"url":"https://github.com/OWNER1/REPO1/issues/1"}}}}`, func(input map[string]interface{}) {
185 assert.Equal(t, input["issueId"], "THE-ID")
186 assert.Equal(t, input["repositoryId"], "dest-id")
187 }))
188
189 output, err := runCommand(http, "1234 OWNER1/REPO1")
190 if err != nil {
191 t.Errorf("error running command `issue transfer`: %v", err)
192 }
193 assert.Equal(t, "https://github.com/OWNER1/REPO1/issues/1\n", output.String())
194}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
EqualMethod · 0.80
runCommandFunction · 0.70
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected