MCPcopy
hub / github.com/cli/cli / TestProjectFeatures

Function TestProjectFeatures

internal/featuredetection/feature_detection_test.go:590–674  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

588}
589
590func 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 `),

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
ProjectFeaturesMethod · 0.95
ReplaceTripperFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected