MCPcopy Create free account
hub / github.com/cli/cli / TestPullRequestFeatures

Function TestPullRequestFeatures

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

Source from the content-addressed store, hash-verified

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