Files
miti99bot/internal/modules/loldle/lookup_test.go
T
tiennm99 f632c68956 refactor(modules): drop loldle variants, semantle, doantu and dead framework surface
Removes six modules (loldle-ability/emoji/quote/splash, semantle, doantu)
and prunes the framework deps that were only there to serve them:

  - ai.Embedder + Client.Embed + embeddingModel const (semantle only)
  - Deps.Embedder + BuildOptions.Embedder
  - Deps.Env + Build(env) param + ModuleEnv config field + PHOW2SIM allowlist (doantu only)
  - internal/champname package (loldle now owns its lookup helpers directly)
  - template.yaml: Phow2simAPIURL parameter + PHOW2SIM_API_URL Lambda env

Active catalog: util, misc, wordle, loldle, lolschedule, twentyq, trading.

go build / vet / test all pass.
2026-05-11 16:02:06 +07:00

48 lines
1.2 KiB
Go

package loldle
import "testing"
func TestLoadChampions_EmbedIsValid(t *testing.T) {
cs := loadChampions()
if n := len(cs); n < 150 || n > 200 {
t.Errorf("champion count = %d, want ~172", n)
}
got := findChampionByExactName(cs, "Aatrox")
if got == nil {
t.Fatal("expected Aatrox in embedded list")
}
if got.Gender != "Male" || got.Resource != "Manaless" {
t.Errorf("Aatrox shape unexpected: %+v", got)
}
}
func TestFindChampion(t *testing.T) {
pool := []Champion{{ChampionName: "Aatrox"}, {ChampionName: "Ahri"}, {ChampionName: "Kai'Sa"}}
cases := []struct {
input string
want string // "" means no match
}{
{"Aatrox", "Aatrox"},
{"aatrox", "Aatrox"},
{"kaisa", "Kai'Sa"},
{"KAI SA", "Kai'Sa"},
{"Aat", "Aatrox"}, // unique prefix
{"A", ""}, // ambiguous prefix
{"", ""}, // empty
{"!!!", ""}, // no alphanumerics
{"zed", ""}, // no match
}
for _, tc := range cases {
got := findChampion(pool, tc.input)
if tc.want == "" {
if got != nil {
t.Errorf("findChampion(%q) = %+v, want nil", tc.input, got)
}
continue
}
if got == nil || got.ChampionName != tc.want {
t.Errorf("findChampion(%q) = %+v, want %q", tc.input, got, tc.want)
}
}
}