nandi/oripublic Fork 0
35061753be581c0ba47a3189520d64e7788c183d
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
✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme 76d62ac k33g yesterday1import { render, screen, waitFor } from "@testing-library/react";
2import { describe, expect, it } from "vitest";
3import { AsciiDocView } from "./AsciiDocView";
4
5// Deliberately NOT mocked: this exercises the real @asciidoctor/core module
6// resolution and conversion — the exact integration that once broke in
7// production while every mocked test stayed green.
8describe("AsciiDocView (real converter)", () => {
9 it("renders a document with title, section and list", async () => {
10 render(
11 <AsciiDocView
12 content={
13 "= The Title\n\n== Section\n\n* item one\n* item two\n\nSome *bold* text."
14 }
15 />,
16 );
17
18 await waitFor(() => expect(screen.getByText("The Title")).toBeDefined(), {
19 timeout: 15000,
20 });
21 expect(screen.getByText("Section")).toBeDefined();
22 expect(screen.getByText("item one")).toBeDefined();
23 expect(screen.getByText("bold")).toBeDefined();
24 }, 20000);
25
26 it("re-renders when the content changes", async () => {
27 const { rerender } = render(<AsciiDocView content="= First" />);
28 await waitFor(() => expect(screen.getByText("First")).toBeDefined(), {
29 timeout: 15000,
30 });
31
32 rerender(<AsciiDocView content="= Second" />);
33 await waitFor(() => expect(screen.getByText("Second")).toBeDefined());
34 }, 20000);
35});