mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-28 08:20:44 +00:00
3ac06bffaa
Closes deferred phases 04 + 05 of loldle-new-modes plan. - loldle-ability: 5 guesses, DDragon ability icon as photo. State pins slot (P/Q/W/E/R) so the same icon shows every turn. Abilities pulled from DDragon per-champion — same source loldle.net uses at runtime. - loldle-splash: 4 guesses, random skin splash as photo. Skin pool scraped from loldle.net bundle (var Ad=[…] — 172 champs × 1939 skins, non-chroma, matches their splash mode exactly). URLs from Riot DDragon CDN (no version segment, stable across patches). - fetch-ddragon-data.js: extended to write all four JSONs in one run. Shares a single DDragon per-champion fetch cycle (concurrency 10). - Credits loldle.net + Riot Games in all loldle-family READMEs. 19 new tests (503 total). Lint clean. register:dry reports 12 loldle_* commands with no conflicts.
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
import { describe, expect, it } from "vitest";
|
|
import { findChampion } from "../../../src/modules/loldle-ability/lookup.js";
|
|
|
|
const pool = [
|
|
{ championName: "Ahri", abilities: [{ slot: "Q", name: "Orb of Deception", icon: "x" }] },
|
|
{ championName: "Akali", abilities: [{ slot: "R", name: "Perfect Execution", icon: "x" }] },
|
|
{ championName: "Miss Fortune", abilities: [{ slot: "P", name: "Love Tap", icon: "x" }] },
|
|
];
|
|
|
|
describe("findChampion (ability pool)", () => {
|
|
it("matches case-insensitively", () => {
|
|
expect(findChampion(pool, "ahri").championName).toBe("Ahri");
|
|
});
|
|
|
|
it("normalizes punctuation and spaces", () => {
|
|
expect(findChampion(pool, "MissFortune").championName).toBe("Miss Fortune");
|
|
expect(findChampion(pool, "miss fortune").championName).toBe("Miss Fortune");
|
|
});
|
|
|
|
it("unique prefix resolves", () => {
|
|
expect(findChampion(pool, "mi").championName).toBe("Miss Fortune");
|
|
expect(findChampion(pool, "ak").championName).toBe("Akali");
|
|
});
|
|
|
|
it("returns null on empty / no-match / ambiguous", () => {
|
|
expect(findChampion(pool, "")).toBeNull();
|
|
expect(findChampion(pool, "zzz")).toBeNull();
|
|
expect(findChampion(pool, "a")).toBeNull();
|
|
});
|
|
});
|