2026-05-26 03:40:01 +08:00

33 lines
840 B
Go

package appconfig
import "testing"
func TestNormalizeBannerDisplayScopeAcceptsChineseLabels(t *testing.T) {
cases := map[string]string{
"": "home",
"首页": "home",
"房间内": "room",
"充值页": "recharge",
"ROOM": "room",
"bad": "",
}
for input, want := range cases {
if got := NormalizeBannerDisplayScope(input); got != want {
t.Fatalf("scope %q mismatch: got %q want %q", input, got, want)
}
}
}
func TestBannerDisplayScopeListParsesMultiScopeValue(t *testing.T) {
got := bannerDisplayScopeList("room,home,recharge")
want := []string{"home", "room", "recharge"}
if len(got) != len(want) {
t.Fatalf("scope count mismatch: got %+v want %+v", got, want)
}
for index := range want {
if got[index] != want[index] {
t.Fatalf("scope %d mismatch: got %+v want %+v", index, got, want)
}
}
}