MCPcopy
hub / github.com/github/github-mcp-server / TestIcons

Function TestIcons

pkg/octicons/octicons_test.go:56–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestIcons(t *testing.T) {
57 tests := []struct {
58 name string
59 icon string
60 wantNil bool
61 wantCount int
62 }{
63 {
64 name: "valid embedded icon returns light and dark variants",
65 icon: "repo",
66 wantNil: false,
67 wantCount: 2,
68 },
69 {
70 name: "empty name returns nil",
71 icon: "",
72 wantNil: true,
73 wantCount: 0,
74 },
75 }
76
77 for _, tc := range tests {
78 t.Run(tc.name, func(t *testing.T) {
79 result := Icons(tc.icon)
80 if tc.wantNil {
81 assert.Nil(t, result)
82 return
83 }
84 assert.NotNil(t, result)
85 assert.Len(t, result, tc.wantCount)
86
87 // Verify first icon is light theme
88 assert.Equal(t, DataURI(tc.icon, ThemeLight), result[0].Source)
89 assert.Equal(t, "image/png", result[0].MIMEType)
90 assert.Empty(t, result[0].Sizes) // Sizes field omitted for backward compatibility
91 assert.Equal(t, mcp.IconThemeLight, result[0].Theme)
92
93 // Verify second icon is dark theme
94 assert.Equal(t, DataURI(tc.icon, ThemeDark), result[1].Source)
95 assert.Equal(t, "image/png", result[1].MIMEType)
96 assert.Empty(t, result[1].Sizes) // Sizes field omitted for backward compatibility
97 assert.Equal(t, mcp.IconThemeDark, result[1].Theme)
98 })
99 }
100}
101
102func TestThemeConstants(t *testing.T) {
103 assert.Equal(t, Theme("light"), ThemeLight)

Callers

nothing calls this directly

Calls 2

IconsFunction · 0.85
DataURIFunction · 0.85

Tested by

no test coverage detected