// PostBody on its own (lane posts-library): the post viewer's body drawn with // no modal and no query client, and PostModal still exporting it. // // Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test components/PostBody.test.ts import { test } from "node:test"; import assert from "node:assert/strict"; import * as React from "react"; import { renderToStaticMarkup } from "react-dom/server"; import { PostBody, PostCapturePanel } from "./PostBody"; import * as modal from "./PostModal"; import type { Post } from "../lib/posts"; (globalThis as { React?: typeof React }).React = React; const POST: Post = { id: "1900000000000001001", slug: "lib/1900000000000001001", channelSlug: "lib", author: "teapot_news", authorName: "Teapot News", createdAt: "2026-11-16T12:00:00.000Z", uploadDate: "20261116", text: "The kettle festival opens today.", url: "https://x.com/teapot_news/status/1900000000000001001", platform: "twitter", isReply: false, isRepost: false, links: ["https://example.org/a"], mediaCount: 2, }; test("a post is drawn with its author, words, links and footer; its captured media in the capture panel", () => { const html = renderToStaticMarkup( React.createElement(PostBody, { post: POST, capture: { capturedAt: "2026-11-17T10:00:00.000Z", state: "captured", shot: { src: "/m/shot.png" }, media: [{ src: "/m/a.jpg", name: "a.jpg" }, { src: "/m/b.mp4", name: "b.mp4" }] }, }), ); assert.match(html, /data-post-id="1900000000000001001"/); assert.match(html, /Teapot News/); assert.match(html, /@teapot_news/); assert.match(html, /The kettle festival opens today\./); assert.match(html, /data-post-capture-shot=""/); assert.match(html, /