// @vitest-environment happy-dom import { useEffect } from "react"; import { describe, expect, it } from "vitest"; import { render, screen } from "@testing-library/react"; import { createEngine, type Engine } from "@engine/index"; import { ingestHtmlFromFile } from "@source/index"; import { EngineProvider, useActiveDocumentId, usePdfByteStore } from "./EngineContext"; import { ViewerShell } from "./ViewerShell"; function BootstrapHtmlDoc({ engine, file, }: { readonly engine: Engine; readonly file: File; }) { const byteStore = usePdfByteStore(); const { setId } = useActiveDocumentId(); useEffect(() => { void ingestHtmlFromFile(file, byteStore).then(({ document, representation }) => { engine.documents.register({ document, representation }); setId(document.id); }); }, [byteStore, engine, file, setId]); return null; } describe("ViewerShell (dom)", () => { it("renders HtmlViewerAdapter content for html-dom documents", async () => { const engine = createEngine(); const file = new File( ["
Dom viewer smoke test
"], "sample.html", { type: "text/html" }, ); render(