import assert from 'node:assert/strict' import React from 'react' import { renderToStaticMarkup } from 'react-dom/server' import { ReactMarkdown } from '../src/renderer/src/workbuddy/markdown/ReactMarkdown' import { ReactMarkdownProvider, type TableActionContext } from '../src/renderer/src/workbuddy/markdown/context' import { createMarkdownParser } from '../src/renderer/src/workbuddy/markdown/parser' const source='| 路径 | 持久化状态 | 内容 |\n| --- | --- | --- |\n| 取消 | `cancelled` ✓ | 0 字符 |\n| 正常 | `done` ✓ | 「收到」 |' function render(text: string, finished = true, action?: (context: TableActionContext) => React.ReactNode): string { return renderToStaticMarkup( {text} ) } const html=render(source) assert.equal((html.match(/class="cr-table-block /g)??[]).length,1) assert.match(html,/cr-table-block__scroller/) assert.match(html,/cr-table-block__inner/) assert.equal((html.match(/cr-inline-code markdown-content__inline-code/g)??[]).length,2) assert.match(html,/<\/code>(?:)? ✓/,'code and checkmark retain the original separating space') assert.equal((html.match(/{context.push(value);return } const quoted=render(source,false,action) assert.match(quoted,/