(t *testing.T)
| 588 | } |
| 589 | |
| 590 | func TestProjectFeatures(t *testing.T) { |
| 591 | tests := []struct { |
| 592 | name string |
| 593 | hostname string |
| 594 | queryResponse map[string]string |
| 595 | wantFeatures ProjectFeatures |
| 596 | wantErr bool |
| 597 | }{ |
| 598 | { |
| 599 | name: "github.com", |
| 600 | hostname: "github.com", |
| 601 | wantFeatures: ProjectFeatures{ |
| 602 | ProjectItemQuery: true, |
| 603 | }, |
| 604 | }, |
| 605 | { |
| 606 | name: "ghec data residency (ghe.com)", |
| 607 | hostname: "stampname.ghe.com", |
| 608 | wantFeatures: ProjectFeatures{ |
| 609 | ProjectItemQuery: true, |
| 610 | }, |
| 611 | }, |
| 612 | { |
| 613 | name: "GHE empty response", |
| 614 | hostname: "git.my.org", |
| 615 | queryResponse: map[string]string{ |
| 616 | `query ProjectV2_fields\b`: `{"data": {}}`, |
| 617 | }, |
| 618 | wantFeatures: ProjectFeatures{}, |
| 619 | }, |
| 620 | { |
| 621 | name: "GHE items field without query arg", |
| 622 | hostname: "git.my.org", |
| 623 | queryResponse: map[string]string{ |
| 624 | `query ProjectV2_fields\b`: heredoc.Doc(` |
| 625 | { "data": { "ProjectV2": { "fields": [ |
| 626 | {"name": "items", "args": [ |
| 627 | {"name": "after"}, |
| 628 | {"name": "first"} |
| 629 | ]} |
| 630 | ] } } } |
| 631 | `), |
| 632 | }, |
| 633 | wantFeatures: ProjectFeatures{}, |
| 634 | }, |
| 635 | { |
| 636 | name: "GHE items field with query arg", |
| 637 | hostname: "git.my.org", |
| 638 | queryResponse: map[string]string{ |
| 639 | `query ProjectV2_fields\b`: heredoc.Doc(` |
| 640 | { "data": { "ProjectV2": { "fields": [ |
| 641 | {"name": "items", "args": [ |
| 642 | {"name": "after"}, |
| 643 | {"name": "first"}, |
| 644 | {"name": "query"} |
| 645 | ]} |
| 646 | ] } } } |
| 647 | `), |
nothing calls this directly
no test coverage detected