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

Function TestProjectV1Support

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

Source from the content-addressed store, hash-verified

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