feat(问翻小宝): 增加静态入口页面

关键改动:

- 新增问翻小宝页面,包含历史记录、对话和语音输入区域

- 在侧边栏加入独立入口并放在小宝预警之前

- 增加页面结构和导航顺序测试

Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
Script Generator
2026-06-30 19:10:41 +08:00
parent 0043fa9682
commit 846bf9e8d1
3 changed files with 221 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
test('sidebar links wenfan xiaobao as an independent entry before xiaobao warning', () => {
const sidebar = readFileSync(join(process.cwd(), 'components/layout/Sidebar.tsx'), 'utf8');
const askIndex = sidebar.indexOf("label: '问翻小宝'");
const warningIndex = sidebar.indexOf("label: '小宝预警'");
assert.notEqual(askIndex, -1);
assert.notEqual(warningIndex, -1);
assert.ok(askIndex < warningIndex);
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, /历史记录/);
assert.match(page, /对话/);
assert.match(page, /textarea/);
assert.match(page, /Mic/);
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\)\]'/);
});