const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') const root = path.resolve(__dirname, '..') const pagePath = path.join(root, 'pages/ai-house/index.vue') const componentPath = path.join(root, 'uni_modules/mp-html/components/mp-html/mp-html.vue') const markdownPluginPath = path.join(root, 'uni_modules/mp-html/components/mp-html/markdown/index.js') const page = fs.readFileSync(pagePath, 'utf8') const component = fs.readFileSync(componentPath, 'utf8') assert.match(page, /v-if="message\.role === 'ai'"[\s\S]*:content="message\.content"[\s\S]*markdown/) assert.match(component, /markdown:\s*Boolean/) assert.match(component, /require\('\.\/markdown\/index\.js'\)/) const Markdown = require(markdownPluginPath) const html = new Markdown({ markdown: true }).onUpdate('# 标题\n\n**重点**\n\n- 房源 A') assert.match(html, /]*>标题<\/h1>/) assert.match(html, /重点<\/strong>/) assert.match(html, /
  • 房源 A<\/li>/) console.log('AI 找房 Markdown 渲染配置检查通过')