MCPcopy
hub / github.com/cli/cli / TestProjectV1Support

Function TestProjectV1Support

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

Source from the content-addressed store, hash-verified

374}
375
376func TestProjectV1Support(t *testing.T) {
377 tests := []struct {
378 name string
379 hostname string
380 httpStubs func(*httpmock.Registry)
381 wantFeatures gh.ProjectsV1Support
382 }{
383 {
384 name: "github.com",
385 hostname: "github.com",
386 wantFeatures: gh.ProjectsV1Unsupported,
387 },
388 {
389 name: "ghec data residency (ghe.com)",
390 hostname: "stampname.ghe.com",
391 wantFeatures: gh.ProjectsV1Unsupported,
392 },
393 {
394 name: "GHE 3.16.0",
395 hostname: "git.my.org",
396 httpStubs: func(reg *httpmock.Registry) {
397 reg.Register(
398 httpmock.REST("GET", "api/v3/meta"),
399 httpmock.StringResponse(`{"installed_version":"3.16.0"}`),
400 )
401 },
402 wantFeatures: gh.ProjectsV1Supported,
403 },
404 {
405 name: "GHE 3.16.1",
406 hostname: "git.my.org",
407 httpStubs: func(reg *httpmock.Registry) {
408 reg.Register(
409 httpmock.REST("GET", "api/v3/meta"),
410 httpmock.StringResponse(`{"installed_version":"3.16.1"}`),
411 )
412 },
413 wantFeatures: gh.ProjectsV1Supported,
414 },
415 {
416 name: "GHE 3.17",
417 hostname: "git.my.org",
418 httpStubs: func(reg *httpmock.Registry) {
419 reg.Register(
420 httpmock.REST("GET", "api/v3/meta"),
421 httpmock.StringResponse(`{"installed_version":"3.17.0"}`),
422 )
423 },
424 wantFeatures: gh.ProjectsV1Unsupported,
425 },
426 }
427
428 for _, tt := range tests {
429 t.Run(tt.name, func(t *testing.T) {
430 t.Parallel()
431 reg := &httpmock.Registry{}
432 if tt.httpStubs != nil {
433 tt.httpStubs(reg)

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
ProjectsV1Method · 0.95
RESTFunction · 0.92
StringResponseFunction · 0.92
ReplaceTripperFunction · 0.92
NewDetectorFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected