- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换 - 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片 - 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转 - 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出 - 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志 - 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票 - 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏 - 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
115 行
4.4 KiB
TypeScript
115 行
4.4 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import defaultI18n from '../src/locale/index.ts';
|
|
|
|
const adminRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const brandKitPagePath = path.join(
|
|
adminRoot,
|
|
'src/pages/team/brand-kit/index.tsx'
|
|
);
|
|
const brandKitLocalePath = path.join(
|
|
adminRoot,
|
|
'src/pages/team/brand-kit/locale/index.ts'
|
|
);
|
|
|
|
function readPage(): string {
|
|
assert.ok(fs.existsSync(brandKitPagePath), 'Brand Kit 页面必须存在');
|
|
return fs.readFileSync(brandKitPagePath, 'utf-8');
|
|
}
|
|
|
|
test('1. team/brand-kit 必须请求 brand/page 与 add 或 update,并使用 Arco Form', () => {
|
|
const content = readPage();
|
|
|
|
assert.ok(
|
|
content.includes('admin/team/brand/page'),
|
|
'必须请求 POST /api/admin/team/brand/page'
|
|
);
|
|
assert.ok(
|
|
content.includes('admin/team/brand/add') ||
|
|
content.includes('admin/team/brand/update'),
|
|
'必须请求 POST /api/admin/team/brand/add 或 update'
|
|
);
|
|
assert.ok(content.includes('Form'), '必须使用 Arco Form');
|
|
assert.ok(
|
|
content.includes("from '@arco-design/web-react'"),
|
|
'必须从 @arco-design/web-react 引入组件'
|
|
);
|
|
assert.ok(
|
|
content.includes('code === 1000') || content.includes('code ===1000'),
|
|
'必须按 Cool-Admin code === 1000 判断成功'
|
|
);
|
|
assert.ok(content.includes('Message.error'), '失败必须使用 Arco Message.error');
|
|
assert.ok(
|
|
!content.includes('Mock.js') && !content.includes("from 'mockjs'"),
|
|
'禁止用 Mock.js 假数据冒充成功'
|
|
);
|
|
assert.ok(!/\bany\b/.test(content), '禁止使用 any');
|
|
});
|
|
|
|
test('2. team/brand-kit 必须拉取 size=1、保存按 id 分流,并预览 token 主色', () => {
|
|
const content = readPage();
|
|
|
|
assert.ok(content.includes("from '@/types/omni'"), '必须复用 admin/src/types/omni.ts');
|
|
assert.ok(content.includes('BrandKit'), '必须使用 BrandKit 类型');
|
|
assert.ok(content.includes('TenantProfile'), '必须使用 TenantProfile 类型');
|
|
assert.ok(
|
|
content.includes('lightColors') || content.includes('#0B5CFF'),
|
|
'必须引用 lightColors.primary 或默认 #0B5CFF'
|
|
);
|
|
assert.ok(content.includes('lightColors.primary') || content.includes('#0B5CFF'));
|
|
|
|
assert.ok(content.includes('companyName'), '表单必须包含 companyName');
|
|
assert.ok(content.includes('logoUrl'), '表单必须包含 logoUrl');
|
|
assert.ok(content.includes('primaryColor'), '表单必须包含 primaryColor');
|
|
assert.ok(
|
|
content.includes('size: 1') || content.includes('size:1'),
|
|
'page 必须 size=1 取当前租户品牌'
|
|
);
|
|
assert.ok(
|
|
content.includes('admin/team/brand/add'),
|
|
'无 id 保存必须请求 add'
|
|
);
|
|
assert.ok(
|
|
content.includes('admin/team/brand/update'),
|
|
'有 id 保存必须请求 update'
|
|
);
|
|
assert.ok(content.includes('type="primary"'), '必须有一个主 CTA');
|
|
assert.ok(
|
|
!content.includes('#000') && !content.includes('#000000'),
|
|
'禁止纯黑'
|
|
);
|
|
assert.ok(
|
|
!content.includes('Mock.js') && !content.includes("from 'mockjs'"),
|
|
'禁止用 Mock.js'
|
|
);
|
|
assert.ok(!/\bany\b/.test(content), '禁止使用 any');
|
|
});
|
|
|
|
test('3. team/brand-kit locale 必须包含 menu.team.brandKit 与中英文案', () => {
|
|
assert.ok(fs.existsSync(brandKitLocalePath), 'Brand Kit 语言包必须存在');
|
|
const content = fs.readFileSync(brandKitLocalePath, 'utf-8');
|
|
|
|
assert.ok(
|
|
content.includes("'menu.team.brandKit'"),
|
|
'页面语言包必须包含 menu.team.brandKit'
|
|
);
|
|
assert.ok(content.includes("'en-US'"), '必须包含英文案');
|
|
assert.ok(content.includes("'zh-CN'"), '必须包含中文案');
|
|
assert.ok(content.includes('teamBrandKit.request.fail'), '必须包含失败提示文案');
|
|
assert.ok(content.includes('teamBrandKit.form.save'), '必须包含保存主 CTA 文案');
|
|
assert.ok(content.includes('companyName'), '必须包含 companyName 文案');
|
|
assert.ok(content.includes('logoUrl'), '必须包含 logoUrl 文案');
|
|
assert.ok(content.includes('primaryColor'), '必须包含 primaryColor 文案');
|
|
assert.ok(!/\bany\b/.test(content), 'locale 禁止使用 any');
|
|
assert.ok(
|
|
!/[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/u.test(content),
|
|
'locale 禁止使用 emoji'
|
|
);
|
|
|
|
assert.equal(defaultI18n['en-US']['menu.team.brandKit'], 'Brand Kit');
|
|
assert.equal(defaultI18n['zh-CN']['menu.team.brandKit'], '品牌规范');
|
|
});
|