import { expect, test } from "bun:test"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; import { MessageMarkdown } from "./markdown"; let PARTICIPANT_MESSAGE = [ "**Bold** and *italic* with [the docs](https://example.com).", "", "- first", "- second", "", "1. one", "2. two", "", "> quoted", "", "Use `bun test`.", "", "```ts", "let answer = 42;", "```", "", "# Ordinary message text", "", "![remote](https://example.invalid/pixel.png)", 'raw', ].join("\n"); function markdown(source: string): string { return renderToStaticMarkup(createElement(MessageMarkdown, { source })); } test("conversation Markdown admits formatting without document features", () => { let markup = markdown(PARTICIPANT_MESSAGE); expect(markup).toContain("Bold"); expect(markup).toContain("italic"); expect(markup).toContain("