(t *testing.T)
| 303 | } |
| 304 | |
| 305 | func TestRunCreateField_Me(t *testing.T) { |
| 306 | defer gock.Off() |
| 307 | gock.Observe(gock.DumpRequest) |
| 308 | // get viewer ID |
| 309 | gock.New("https://api.github.com"). |
| 310 | Post("/graphql"). |
| 311 | MatchType("json"). |
| 312 | JSON(map[string]interface{}{ |
| 313 | "query": "query ViewerOwner.*", |
| 314 | }). |
| 315 | Reply(200). |
| 316 | JSON(map[string]interface{}{ |
| 317 | "data": map[string]interface{}{ |
| 318 | "viewer": map[string]interface{}{ |
| 319 | "id": "an ID", |
| 320 | }, |
| 321 | }, |
| 322 | }) |
| 323 | |
| 324 | // get project ID |
| 325 | gock.New("https://api.github.com"). |
| 326 | Post("/graphql"). |
| 327 | MatchType("json"). |
| 328 | JSON(map[string]interface{}{ |
| 329 | "query": "query ViewerProject.*", |
| 330 | "variables": map[string]interface{}{ |
| 331 | "number": 1, |
| 332 | "firstItems": 0, |
| 333 | "afterItems": nil, |
| 334 | "firstFields": 0, |
| 335 | "afterFields": nil, |
| 336 | }, |
| 337 | }). |
| 338 | Reply(200). |
| 339 | JSON(map[string]interface{}{ |
| 340 | "data": map[string]interface{}{ |
| 341 | "viewer": map[string]interface{}{ |
| 342 | "projectV2": map[string]interface{}{ |
| 343 | "id": "an ID", |
| 344 | }, |
| 345 | }, |
| 346 | }, |
| 347 | }) |
| 348 | |
| 349 | // create Field |
| 350 | gock.New("https://api.github.com"). |
| 351 | Post("/graphql"). |
| 352 | BodyString(`{"query":"mutation CreateField.*","variables":{"input":{"projectId":"an ID","dataType":"TEXT","name":"a name"}}}`). |
| 353 | Reply(200). |
| 354 | JSON(map[string]interface{}{ |
| 355 | "data": map[string]interface{}{ |
| 356 | "createProjectV2Field": map[string]interface{}{ |
| 357 | "projectV2Field": map[string]interface{}{ |
| 358 | "id": "Field ID", |
| 359 | }, |
| 360 | }, |
| 361 | }, |
| 362 | }) |
nothing calls this directly
no test coverage detected