(t *testing.T)
| 291 | } |
| 292 | |
| 293 | func TestRunCreateItem_Draft_Me(t *testing.T) { |
| 294 | defer gock.Off() |
| 295 | gock.Observe(gock.DumpRequest) |
| 296 | // get viewer ID |
| 297 | gock.New("https://api.github.com"). |
| 298 | Post("/graphql"). |
| 299 | MatchType("json"). |
| 300 | JSON(map[string]interface{}{ |
| 301 | "query": "query ViewerOwner.*", |
| 302 | }). |
| 303 | Reply(200). |
| 304 | JSON(map[string]interface{}{ |
| 305 | "data": map[string]interface{}{ |
| 306 | "viewer": map[string]interface{}{ |
| 307 | "id": "an ID", |
| 308 | }, |
| 309 | }, |
| 310 | }) |
| 311 | |
| 312 | // get project ID |
| 313 | gock.New("https://api.github.com"). |
| 314 | Post("/graphql"). |
| 315 | MatchType("json"). |
| 316 | JSON(map[string]interface{}{ |
| 317 | "query": "query ViewerProject.*", |
| 318 | "variables": map[string]interface{}{ |
| 319 | "number": 1, |
| 320 | "firstItems": 0, |
| 321 | "afterItems": nil, |
| 322 | "firstFields": 0, |
| 323 | "afterFields": nil, |
| 324 | }, |
| 325 | }). |
| 326 | Reply(200). |
| 327 | JSON(map[string]interface{}{ |
| 328 | "data": map[string]interface{}{ |
| 329 | "viewer": map[string]interface{}{ |
| 330 | "projectV2": map[string]interface{}{ |
| 331 | "id": "an ID", |
| 332 | }, |
| 333 | }, |
| 334 | }, |
| 335 | }) |
| 336 | |
| 337 | // create item |
| 338 | gock.New("https://api.github.com"). |
| 339 | Post("/graphql"). |
| 340 | BodyString(`{"query":"mutation CreateDraftItem.*","variables":{"input":{"projectId":"an ID","title":"a title","body":"a body"}}}`). |
| 341 | Reply(200). |
| 342 | JSON(map[string]interface{}{ |
| 343 | "data": map[string]interface{}{ |
| 344 | "addProjectV2DraftIssue": map[string]interface{}{ |
| 345 | "projectItem": map[string]interface{}{ |
| 346 | "id": "item ID", |
| 347 | }, |
| 348 | }, |
| 349 | }, |
| 350 | }) |
nothing calls this directly
no test coverage detected