MCPcopy
hub / github.com/cli/cli / TestIssueFeatures

Function TestIssueFeatures

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

Source from the content-addressed store, hash-verified

12)
13
14func TestIssueFeatures(t *testing.T) {
15 issueFieldsWithRelationships := `{"data":{"Issue":{"fields":[{"name":"title"},{"name":"body"},{"name":"blockedBy"}]}}}`
16 issueFieldsWithoutRelationships := `{"data":{"Issue":{"fields":[{"name":"title"},{"name":"body"}]}}}`
17
18 tests := []struct {
19 name string
20 hostname string
21 queryResponse map[string]string
22 wantFeatures IssueFeatures
23 wantErr bool
24 }{
25 {
26 name: "github.com",
27 hostname: "github.com",
28 wantFeatures: IssueFeatures{
29 ApiActorsSupported: true,
30 IssueRelationshipsSupported: true,
31 },
32 wantErr: false,
33 },
34 {
35 name: "ghec data residency (ghe.com)",
36 hostname: "stampname.ghe.com",
37 wantFeatures: IssueFeatures{
38 ApiActorsSupported: true,
39 IssueRelationshipsSupported: true,
40 },
41 wantErr: false,
42 },
43 {
44 name: "GHE with relationship support",
45 hostname: "git.my.org",
46 queryResponse: map[string]string{
47 `query Issue_fields`: issueFieldsWithRelationships,
48 },
49 wantFeatures: IssueFeatures{
50 ApiActorsSupported: false,
51 IssueRelationshipsSupported: true,
52 },
53 wantErr: false,
54 },
55 {
56 name: "GHE without relationship support",
57 hostname: "git.my.org",
58 queryResponse: map[string]string{
59 `query Issue_fields`: issueFieldsWithoutRelationships,
60 },
61 wantFeatures: IssueFeatures{
62 ApiActorsSupported: false,
63 IssueRelationshipsSupported: false,
64 },
65 wantErr: false,
66 },
67 }
68
69 for _, tt := range tests {
70 t.Run(tt.name, func(t *testing.T) {
71 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
IssueFeaturesMethod · 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