feat(widget): 优化访客在线轨迹、GeoIP与多站点渠道
CI / Frontend (typecheck + lint + build) (push) Successful in 2m5s
CI / Backend (go vet + test) (push) Failing after 5m20s

This commit is contained in:
yml2213
2026-11-06 18:21:30 +08:00
parent 24fac1bcf1
commit 38d6fc1684
37 changed files with 1071 additions and 123 deletions
+21
View File
@@ -0,0 +1,21 @@
package geoip
import "testing"
func TestBuildRegion(t *testing.T) {
got := buildRegion(Location{Country: "中国", Province: "广东省", City: "深圳市"})
if got != "中国 广东省 深圳市" {
t.Fatalf("buildRegion=%q", got)
}
got = buildRegion(Location{Country: "中国", Province: "中国", City: ""})
if got != "中国" {
t.Fatalf("重复地区应去重: %q", got)
}
}
func TestLocalizedNamePrefersChinese(t *testing.T) {
got := localizedName(map[string]string{"en": "China", "zh-CN": "中国"})
if got != "中国" {
t.Fatalf("应优先中文名: %q", got)
}
}