nandi/oripublic Fork 0
3017563d783a895a85f8f8ad162b58bb5d944946
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

AsciiDocView.test.tsx · 35 lines · 1.2 KBTypeScript Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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(
			<AsciiDocView
				content={
					"= The Title\n\n== Section\n\n* item one\n* item two\n\nSome *bold* text."
				}
			/>,
		);

		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(<AsciiDocView content="= First" />);
		await waitFor(() => expect(screen.getByText("First")).toBeDefined(), {
			timeout: 15000,
		});

		rerender(<AsciiDocView content="= Second" />);
		await waitFor(() => expect(screen.getByText("Second")).toBeDefined());
	}, 20000);
});