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

Function TestIsOfficial

pkg/extensions/official_test.go:17–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestIsOfficial(t *testing.T) {
18 tests := []struct {
19 name string
20 extName string
21 extOwner string
22 want bool
23 }{
24 {
25 name: "known official extension matches",
26 extName: "stack",
27 extOwner: "github",
28 want: true,
29 },
30 {
31 name: "known official extension owned by cli matches",
32 extName: "webhook",
33 extOwner: "cli",
34 want: true,
35 },
36 {
37 name: "official name with different owner is not official",
38 extName: "stack",
39 extOwner: "williammartin",
40 want: false,
41 },
42 {
43 name: "official name with empty owner is not official",
44 extName: "stack",
45 extOwner: "",
46 want: false,
47 },
48 {
49 name: "owner comparison is case-insensitive",
50 extName: "stack",
51 extOwner: "GitHub",
52 want: true,
53 },
54 {
55 name: "mixed-case name does not match",
56 extName: "STACK",
57 extOwner: "github",
58 want: false,
59 },
60 {
61 name: "unknown name is not official",
62 extName: "not-a-real-extension",
63 extOwner: "github",
64 want: false,
65 },
66 {
67 name: "empty name is not official",
68 extName: "",
69 extOwner: "github",
70 want: false,
71 },
72 }
73
74 for _, tt := range tests {

Callers

nothing calls this directly

Calls 3

IsOfficialFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected