import test from 'node:test'; import assert from 'node:assert/strict'; import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; test('sidebar labels AI assistant before smart warning', () => { const sidebar = readFileSync(join(process.cwd(), 'components/layout/Sidebar.tsx'), 'utf8'); const askIndex = sidebar.indexOf("label: 'AI 助手'"); const warningIndex = sidebar.indexOf("label: '智能预警'"); assert.notEqual(askIndex, -1); assert.notEqual(warningIndex, -1); assert.ok(askIndex < warningIndex); assert.doesNotMatch(sidebar, /label: '问翻小宝'/); assert.doesNotMatch(sidebar, /label: '小宝预警'/); assert.match(sidebar, /path: '\/wenfan-xiaobao'/); }); test('wenfan xiaobao page provides records, chat, and voice input surfaces', () => { const pagePath = join(process.cwd(), 'app/wenfan-xiaobao/page.tsx'); assert.equal(existsSync(pagePath), true); const page = readFileSync(pagePath, 'utf8'); assert.match(page, /
问翻小宝<\/p>/);
assert.match(page, /入口路径/);
assert.match(page, /必填字段/);
assert.match(page, /状态流转/);
assert.match(page, /注意事项/);
assert.match(page, /previewImage/);
assert.match(page, /aria-modal="true"/);
assert.match(page, /点击放大/);
assert.match(page, /lg:grid-cols-\[300px_minmax\(0,1fr\)\]/);
assert.match(page, /rounded-\[28px\]/);
assert.doesNotMatch(page, /: 'border-\[var\(--line\)\] bg-\[var\(--bg\)\]/);
assert.match(page, /: 'bg-white hover:bg-\[var\(--bg-subtle\)\]'/);
});
test('wenfan xiaobao page requests business analysis before preserving help fallback', () => {
const page = readFileSync(join(process.cwd(), 'app/wenfan-xiaobao/page.tsx'), 'utf8');
assert.match(page, /requestAnalysis/);
assert.match(page, /AnalysisResultBlock/);
assert.match(page, /type: 'analysis'/);
assert.match(page, /type: 'analysis_error'/);
assert.match(page, /currentPermissions/);
assert.match(page, /surface: 'ai_assistant'/);
assert.match(page, /业务分析只读取你已有权限的数据/);
assert.match(page, /业务分析暂不可用/);
assert.match(page, /searchHelpArticles\(question, WENFAN_HELP_ARTICLES\)/);
assert.match(page, /getFallbackHelpMessage\(showFallbackSuggestions\)/);
assert.match(page, /void askQuestion\(input\)/);
assert.match(page, /