import { render, screen, waitFor } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { AsciiDocView } from "./AsciiDocView";
// Deliberately NOT mocked: this exercises the real @asciidoctor/core module
// resolution and conversion — the exact integration that once broke in
// production while every mocked test stayed green.
describe("AsciiDocView (real converter)", () => {
it("renders a document with title, section and list", async () => {
render(
,
);
await waitFor(() => expect(screen.getByText("The Title")).toBeDefined(), {
timeout: 15000,
});
expect(screen.getByText("Section")).toBeDefined();
expect(screen.getByText("item one")).toBeDefined();
expect(screen.getByText("bold")).toBeDefined();
}, 20000);
it("re-renders when the content changes", async () => {
const { rerender } = render();
await waitFor(() => expect(screen.getByText("First")).toBeDefined(), {
timeout: 15000,
});
rerender();
await waitFor(() => expect(screen.getByText("Second")).toBeDefined());
}, 20000);
});