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