feat: add wiki.gg as a second Endfield source
First non-Game8 parser, and the first source that states region-scoped ends: wiki.gg emits ISO timestamps with one timer per server region, so Endfield events now carry exact times and separate Asia / Americas-Europe ends. That gap is up to 13 hours, which is what regionEnds was built for. Two sources for one game also exercised merge for real. It caught both overlaps — including "Bedazzling Dawnstar" against Game8's "Bedazzling Dawnstar Sign-In" — and flagged that the two disagree on the end date by 70 hours rather than averaging them into a date neither states. Matching an appended qualifier needed a prefix test, not a subset test: a subset would also fuse "Gold Clash" with "Gold Rush Clash Royale". Also fixes build-feed picking fixtures by game rather than by source, which handed the wiki.gg page to the Game8 parser once Endfield had two. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f4b133274a
commit
dd596b5a43
@@ -26,6 +26,7 @@ const CASES: Array<{ adapter: Adapter; fixture: string }> = [
|
||||
{ adapter: adapter("wuwa-game8-events"), fixture: "fixtures/wuwa/game8-events-2026-08-14" },
|
||||
{ adapter: adapter("zzz-game8-events"), fixture: "fixtures/zzz/game8-events-2026-08-14" },
|
||||
{ adapter: adapter("endfield-game8-events"), fixture: "fixtures/endfield/game8-events-2026-08-14" },
|
||||
{ adapter: adapter("endfield-wikigg-events"), fixture: "fixtures/endfield/wikigg-events-2026-08-14" },
|
||||
];
|
||||
|
||||
async function runAdapter(adapter: Adapter, fixture: string) {
|
||||
@@ -224,3 +225,34 @@ describe("endfield", () => {
|
||||
expect(rooted?.summary).not.toMatch(/^Period:/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("wiki.gg parser", () => {
|
||||
test("reads exact per-region timers", async () => {
|
||||
// The first source that states region-scoped ends. Asia and the Americas
|
||||
// differ by hours, which is precisely what regionEnds exists to carry.
|
||||
const events = await runAdapter(
|
||||
adapter("endfield-wikigg-events"),
|
||||
"fixtures/endfield/wikigg-events-2026-08-14",
|
||||
);
|
||||
expect(events).toHaveLength(6);
|
||||
|
||||
const heat = events.find((e) => e.title === "HEAT RAGE! MEGA ARENA!");
|
||||
expect(heat?.startPrecision).toBe("exact");
|
||||
expect(heat?.regionScoped).toBe(true);
|
||||
expect(heat?.regionEnds?.asia).toBe("2026-08-12T20:00:00.000Z");
|
||||
expect(heat?.regionEnds?.america).toBe("2026-08-13T09:00:00.000Z");
|
||||
// endsAt is the fallback for a region the source did not list, so it takes
|
||||
// the earliest — never promise more time than some region actually gets.
|
||||
expect(heat?.endsAt).toBe("2026-08-12T20:00:00.000Z");
|
||||
});
|
||||
|
||||
test("links each event to its own wiki page", async () => {
|
||||
const events = await runAdapter(
|
||||
adapter("endfield-wikigg-events"),
|
||||
"fixtures/endfield/wikigg-events-2026-08-14",
|
||||
);
|
||||
for (const e of events) {
|
||||
expect(e.sourceUrl).toStartWith("https://endfield.wiki.gg/wiki/");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user