MCPcopy
hub / github.com/cli/cli / TestPullRequestFeatures

Function TestPullRequestFeatures

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

Source from the content-addressed store, hash-verified

88}
89
90func TestPullRequestFeatures(t *testing.T) {
91 tests := []struct {
92 name string
93 hostname string
94 queryResponse map[string]string
95 wantFeatures PullRequestFeatures
96 wantErr bool
97 }{
98 {
99 name: "github.com with all features",
100 hostname: "github.com",
101 queryResponse: map[string]string{
102 `query PullRequest_fields\b`: heredoc.Doc(`
103 {
104 "data": {
105 "PullRequest": {
106 "fields": [
107 {"name": "isInMergeQueue"},
108 {"name": "isMergeQueueEnabled"}
109 ]
110 },
111 "StatusCheckRollupContextConnection": {
112 "fields": [
113 {"name": "checkRunCount"},
114 {"name": "checkRunCountsByState"},
115 {"name": "statusContextCount"},
116 {"name": "statusContextCountsByState"}
117 ]
118 }
119 }
120 }`),
121 `query PullRequest_fields2\b`: heredoc.Doc(`
122 {
123 "data": {
124 "WorkflowRun": {
125 "fields": [
126 {"name": "event"}
127 ]
128 }
129 }
130 }`),
131 },
132 wantFeatures: PullRequestFeatures{
133 MergeQueue: true,
134 CheckRunAndStatusContextCounts: true,
135 CheckRunEvent: true,
136 },
137 wantErr: false,
138 },
139 {
140 name: "github.com with no merge queue",
141 hostname: "github.com",
142 queryResponse: map[string]string{
143 `query PullRequest_fields\b`: heredoc.Doc(`
144 {
145 "data": {
146 "PullRequest": {
147 "fields": []

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
PullRequestFeaturesMethod · 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