(t *testing.T)
| 549 | } |
| 550 | |
| 551 | func TestRunCreateField_NUMBER(t *testing.T) { |
| 552 | defer gock.Off() |
| 553 | gock.Observe(gock.DumpRequest) |
| 554 | // get viewer ID |
| 555 | gock.New("https://api.github.com"). |
| 556 | Post("/graphql"). |
| 557 | MatchType("json"). |
| 558 | JSON(map[string]interface{}{ |
| 559 | "query": "query ViewerOwner.*", |
| 560 | }). |
| 561 | Reply(200). |
| 562 | JSON(map[string]interface{}{ |
| 563 | "data": map[string]interface{}{ |
| 564 | "viewer": map[string]interface{}{ |
| 565 | "id": "an ID", |
| 566 | }, |
| 567 | }, |
| 568 | }) |
| 569 | |
| 570 | // get project ID |
| 571 | gock.New("https://api.github.com"). |
| 572 | Post("/graphql"). |
| 573 | MatchType("json"). |
| 574 | JSON(map[string]interface{}{ |
| 575 | "query": "query ViewerProject.*", |
| 576 | "variables": map[string]interface{}{ |
| 577 | "number": 1, |
| 578 | "firstItems": 0, |
| 579 | "afterItems": nil, |
| 580 | "firstFields": 0, |
| 581 | "afterFields": nil, |
| 582 | }, |
| 583 | }). |
| 584 | Reply(200). |
| 585 | JSON(map[string]interface{}{ |
| 586 | "data": map[string]interface{}{ |
| 587 | "viewer": map[string]interface{}{ |
| 588 | "projectV2": map[string]interface{}{ |
| 589 | "id": "an ID", |
| 590 | }, |
| 591 | }, |
| 592 | }, |
| 593 | }) |
| 594 | |
| 595 | // create Field |
| 596 | gock.New("https://api.github.com"). |
| 597 | Post("/graphql"). |
| 598 | BodyString(`{"query":"mutation CreateField.*","variables":{"input":{"projectId":"an ID","dataType":"NUMBER","name":"a name"}}}`). |
| 599 | Reply(200). |
| 600 | JSON(map[string]interface{}{ |
| 601 | "data": map[string]interface{}{ |
| 602 | "createProjectV2Field": map[string]interface{}{ |
| 603 | "projectV2Field": map[string]interface{}{ |
| 604 | "id": "Field ID", |
| 605 | }, |
| 606 | }, |
| 607 | }, |
| 608 | }) |
nothing calls this directly
no test coverage detected