import assert from 'node:assert/strict' import test from 'node:test' import { normalizeRichTextImages } from '../src/utils/richText.mjs' test('富文本图片移除固定尺寸并添加响应式内联样式', () => { const html = '

正文

' const result = normalizeRichTextImages(html) assert.doesNotMatch(result, /width="800"|height="1200"|width:800px|height:1200px/) assert.match(result, /width:100%;max-width:100%;height:auto;box-sizing:border-box;/) assert.match(result, /border-radius:8px;/) }) test('非图片富文本保持不变', () => { const html = '

普通正文

' assert.equal(normalizeRichTextImages(html), html) })