(t *testing.T)
| 279 | } |
| 280 | |
| 281 | func TestRunDelete_Me(t *testing.T) { |
| 282 | defer gock.Off() |
| 283 | gock.Observe(gock.DumpRequest) |
| 284 | // get viewer ID |
| 285 | gock.New("https://api.github.com"). |
| 286 | Post("/graphql"). |
| 287 | MatchType("json"). |
| 288 | JSON(map[string]interface{}{ |
| 289 | "query": "query ViewerOwner.*", |
| 290 | }). |
| 291 | Reply(200). |
| 292 | JSON(map[string]interface{}{ |
| 293 | "data": map[string]interface{}{ |
| 294 | "viewer": map[string]interface{}{ |
| 295 | "id": "an ID", |
| 296 | }, |
| 297 | }, |
| 298 | }) |
| 299 | |
| 300 | // get project ID |
| 301 | gock.New("https://api.github.com"). |
| 302 | Post("/graphql"). |
| 303 | MatchType("json"). |
| 304 | JSON(map[string]interface{}{ |
| 305 | "query": "query ViewerProject.*", |
| 306 | "variables": map[string]interface{}{ |
| 307 | "number": 1, |
| 308 | "firstItems": 0, |
| 309 | "afterItems": nil, |
| 310 | "firstFields": 0, |
| 311 | "afterFields": nil, |
| 312 | }, |
| 313 | }). |
| 314 | Reply(200). |
| 315 | JSON(map[string]interface{}{ |
| 316 | "data": map[string]interface{}{ |
| 317 | "viewer": map[string]interface{}{ |
| 318 | "projectV2": map[string]interface{}{ |
| 319 | "id": "an ID", |
| 320 | }, |
| 321 | }, |
| 322 | }, |
| 323 | }) |
| 324 | |
| 325 | // delete item |
| 326 | gock.New("https://api.github.com"). |
| 327 | Post("/graphql"). |
| 328 | BodyString(`{"query":"mutation DeleteProjectItem.*","variables":{"input":{"projectId":"an ID","itemId":"item ID"}}}`). |
| 329 | Reply(200). |
| 330 | JSON(map[string]interface{}{ |
| 331 | "data": map[string]interface{}{ |
| 332 | "deleteProjectV2Item": map[string]interface{}{ |
| 333 | "deletedItemId": "item ID", |
| 334 | }, |
| 335 | }, |
| 336 | }) |
| 337 | |
| 338 | client := queries.NewTestClient() |
nothing calls this directly
no test coverage detected