import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; describe("book missing error pages", () => { it("does not render fallback books on the book detail page", () => { const source = readFileSync(new URL("./BookPage.tsx", import.meta.url), "utf8"); expect(source).not.toContain("getApiFallback"); expect(source).toContain("setBook(null)"); expect(source).toContain("Livre introuvable"); expect(source).toContain("Ce livre n'existe pas dans le catalogue."); }); it("does not open the reader with a fallback book", () => { const source = readFileSync(new URL("./ReaderPage.tsx", import.meta.url), "utf8"); expect(source).not.toContain("getApiFallback"); expect(source).toContain("setBook(null)"); expect(source).toContain("reader-missing-page"); expect(source).toContain("Livre introuvable"); expect(source).toContain("Ce livre n'existe pas dans le catalogue."); }); });