import { expect } from "chai"; import { clearRecipeSources, getRecipeSource, listRecipeSources, } from "../src/lib/recipe-source-registry.js"; import { registerAllRecipeSources } from "../src/sources/index.js"; // Not exercised by any other test file — `registerAllRecipeSources` is // deliberately never imported by `app.ts` (see its own doc comment), so // nothing else in the suite triggers it. Registers/clears explicitly here // rather than relying on module-load order, so this test's outcome doesn't // depend on which other test file Mocha happens to load first. describe("registerAllRecipeSources", () => { afterEach(() => { clearRecipeSources(); }); it("registers TheMealDB into the shared registry", () => { registerAllRecipeSources(); const theMealDb = getRecipeSource("theMealDb"); expect(theMealDb).to.not.be.undefined; expect(theMealDb?.name).to.equal("TheMealDB"); expect(listRecipeSources().map((adapter) => adapter.key)).to.include("theMealDb"); }); it("registers the generic JSON-LD source into the shared registry", () => { registerAllRecipeSources(); const jsonLd = getRecipeSource("jsonLdRecipe"); expect(jsonLd).to.not.be.undefined; expect(jsonLd?.official).to.equal(false); expect(listRecipeSources().map((adapter) => adapter.key)).to.include("jsonLdRecipe"); }); });