(t *testing.T)
| 157 | } |
| 158 | |
| 159 | func 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 | } |
nothing calls this directly
no test coverage detected