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

Function TestIssueFeatures

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

Source from the content-addressed store, hash-verified

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