import { readFileSync } from "node:fs"; import assert from "node:assert/strict"; import test from "node:test"; import { parse } from "yaml"; import { discover } from "../src/feeds.js"; const sources = parse( readFileSync(new URL("../config/sources.yaml", import.meta.url), "utf8"), ).sources; const since = "2026-11-12T03:15:00.000Z"; const until = "2026-11-15T03:15:00.000Z"; test("ARK uses the studio article permalink, not a different forum link in the body", async (t) => { const source = sources.find((row) => row.id === "ark-news"); const permalink = "https://survivetheark.com/index.php?/articles.html/community-crunch-532-a-dragon-of-thorns-and-roses-r2568"; t.mock.method(globalThis, "fetch", async (request) => { assert.equal( request, "https://survivetheark.com/index.php?/rss/3-ark-news.xml/", ); return new Response( `Community Crunch 532: A Dragon of Thorns and Roses${permalink}/Sat, 14 Nov 2026 01:09:40 GMTServer sunset]]>`, ); }); const [story] = await discover(source, since, until); assert.equal(story.url, permalink); assert.equal(story.date, "2026-11-14T01:09:40.000Z"); }); test("Lodestone publication on November 11 stays outside the window after a November 13 syndication", async (t) => { const source = sources.find((row) => row.id === "ffxiv"); t.mock.method(globalThis, "fetch", async (request) => { assert.equal( request, "https://na.finalfantasyxiv.com/lodestone/news/topics.xml", ); return new Response( `FINAL FANTASY XIV x FINAL FANTASY XVI Crossover Event Returns!2026-11-11T08:00:00Z2026-11-13T12:42:21Z`, ); }); assert.deepEqual(await discover(source, since, until), []); });