mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-28 04:20:38 +00:00
refactor(loldle): consume loldle.net's raw schema directly
Drop the in-scraper normalization step — champions.json now mirrors the exact shape emitted by loldle.net's JS bundle. Records use _id, championId, championName, arrays for positions/species/regions/ range_type, "Male"/"Female"/"Other" gender strings, and a full YYYY-MM-DD release_date. Comparison is schema-aware: multi-value keys accept arrays directly, the year axis parses YYYY out of the ISO date, and exact compares stay case-insensitive.
This commit is contained in:
@@ -10,7 +10,7 @@ const sampleResults = [
|
||||
{ key: "region", label: "Region", result: "correct", guessValue: "Runeterra" },
|
||||
{ key: "lane", label: "Lane", result: "partial", guessValue: "Jungle, Support" },
|
||||
{
|
||||
key: "releaseDate",
|
||||
key: "release_date",
|
||||
label: "Year",
|
||||
result: "wrong",
|
||||
direction: "up",
|
||||
@@ -48,7 +48,7 @@ describe("renderGuess", () => {
|
||||
expect(up).toContain("2011 ⬆️");
|
||||
|
||||
const correctYear = sampleResults.map((r) =>
|
||||
r.key === "releaseDate" ? { ...r, result: "correct", direction: undefined } : r,
|
||||
r.key === "release_date" ? { ...r, result: "correct", direction: undefined } : r,
|
||||
);
|
||||
const out = renderGuess("Brand", correctYear);
|
||||
expect(out).not.toContain("⬆️");
|
||||
|
||||
Reference in New Issue
Block a user