import { describe, expect, it } from "vitest"; import { epubFileName } from "./EpubReader"; import { pdfWorkerSrc } from "./pdfWorker"; import { readerErrorMessage } from "./ReaderError"; describe("reader runtime helpers", () => { it("extracts an EPUB file name from the file URL", () => { expect(epubFileName("http://readabook.local/books/12/file?token=abc")).toBe("book.epub"); expect(epubFileName("http://readabook.local/files/example.epub")).toBe("example.epub"); }); it("keeps PDF.js worker source on the bundled module worker", () => { expect(pdfWorkerSrc).toContain("pdf.worker.min.mjs"); }); it("normalizes reader technical errors", () => { expect(readerErrorMessage(new Error("Setting up fake worker failed"), "PDF indisponible")).toBe("Setting up fake worker failed"); expect(readerErrorMessage("", "EPUB indisponible")).toBe("EPUB indisponible"); }); });