mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-28 08:20:44 +00:00
bd5626534b
Ship two new loldle-family modules mirroring loldle.net's non-classic modes. Text-only MVP (ability/splash phases stay deferred). - loldle-emoji: 5 guesses, emoji-sequence clue. Pool derived algorithmically from classic's champions.json metadata (species/region/resource mapping table) since loldle.net's bundle has no static emoji pool. - loldle-quote: 6 guesses, lore-blurb clue. Pool seeded from Data Dragon champion title + first lore sentence; champion name redacted to ___. - scripts/fetch-ddragon-data.js: single generator for both JSONs. - src/util/normalize-name.js: shared lookup helper; loldle/lookup.js refactored to import it. 35 new tests (484 total passing). Lint clean.
22 lines
658 B
JavaScript
22 lines
658 B
JavaScript
import { describe, expect, it } from "vitest";
|
|
import { normalize } from "../../src/util/normalize-name.js";
|
|
|
|
describe("normalize", () => {
|
|
it("lowercases and strips non-alphanumerics", () => {
|
|
expect(normalize("Ahri")).toBe("ahri");
|
|
expect(normalize("Miss Fortune")).toBe("missfortune");
|
|
expect(normalize("Kai'Sa")).toBe("kaisa");
|
|
expect(normalize("Dr. Mundo")).toBe("drmundo");
|
|
});
|
|
|
|
it("handles empty and null input", () => {
|
|
expect(normalize("")).toBe("");
|
|
expect(normalize(null)).toBe("");
|
|
expect(normalize(undefined)).toBe("");
|
|
});
|
|
|
|
it("coerces non-strings", () => {
|
|
expect(normalize(42)).toBe("42");
|
|
});
|
|
});
|