build(master): vendor Simple Icons data and the Ledger fonts
Icons: simple-icons@16.35.0 (CC0), generated by go run ./internal/master/web/icons/gen, which downloads and verifies: https://registry.npmjs.org/simple-icons/-/simple-icons-16.35.0.tgz 20ebead4f6bc93464812a5e260d19fc4d84772e5eeff69a6fbea263ca2441c5f Output (deterministic): simple-icons.json.gz a8f3b504cc21207e8d55d50f3724630a470968da69451c731538589c4debc87b Fonts (@fontsource-variable 5.3.0, latin, SIL OFL 1.1), sha256: 4c8b93f431d462c696e12b9d6a033feb3394d36e66e781357c496b95d8a75e05 schibsted-grotesk-latin-wght-normal.woff2 18be452724bfdc236c074ca94a249a7f41a86752c7d04ab258ce9ed5651f6a7e jetbrains-mono-latin-wght-normal.woff2 15222412a95d70042e66e79bfb3b985653e0693e4d41703bc131bee9c5aa1aa7 OFL-schibsted-grotesk.txt 403581b69dac5cff4079205e01c6b467e56af449ecbd7247693ddb1baafa005b OFL-jetbrains-mono.txt from https://cdn.jsdelivr.net/npm/@fontsource-variable/{schibsted-grotesk,jetbrains-mono}@5.3.0/ Claude-Session: https://claude.ai/code/session_01GAZsp3P7Qto6JnhipxWUJQ
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package icons
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestForImage(t *testing.T) {
|
||||
cases := []struct {
|
||||
ref, want string
|
||||
}{
|
||||
{"gitea/gitea:1.27.3", "gitea"},
|
||||
{"ghcr.io/goauthentik/server:2026.8.2", "authentik"},
|
||||
{"postgres:17.10", "postgresql"},
|
||||
{"grafana/loki:3.4.2", "grafana"},
|
||||
{"docker.n8n.io/n8nio/n8n:1.112.4", "n8n"},
|
||||
{"lscr.io/linuxserver/prowlarr:latest", ""},
|
||||
{"localhost:5000/foo:v1", ""},
|
||||
{"gitea.shcizo.se/shcizo/slusk:v0.8.1", ""},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.ref, func(t *testing.T) {
|
||||
assert.Equal(t, c.want, ForImage(c.ref))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// safePath is a strict allowlist for what an embedded path may contain, since
|
||||
// the paths are written into the page's HTML.
|
||||
var safePath = regexp.MustCompile(`^[MmLlHhVvCcSsQqTtAaZz0-9.,\- e]+$`)
|
||||
|
||||
func TestEmbeddedSet(t *testing.T) {
|
||||
assert.Greater(t, Count(), 3000)
|
||||
for slug, p := range paths {
|
||||
if !safePath.MatchString(p) {
|
||||
t.Errorf("icon %q has unexpected characters in its path", slug)
|
||||
}
|
||||
}
|
||||
p, ok := Path("gitea")
|
||||
assert.True(t, ok)
|
||||
assert.NotEmpty(t, p)
|
||||
_, ok = Path("no-such-icon")
|
||||
assert.False(t, ok)
|
||||
}
|
||||
Reference in New Issue
Block a user