- [P0安全底座] 多租户数据闭环:公开留资与雷达足迹自动逆向追溯绑定名片 tenantId 与归属销售 userId - [P0性能稳定] 消除内存全量加载:公海池分批带条件扫描回收,雷达国家分布改用 SQL 原生 GROUP BY 聚合查询彻底消除 OOM 隐患 - [P0商业变现] 商业化配额门禁切面:在 Cool-Admin modifyBefore 生命周期织入 assertQuotaAvailable 校验,阻断超额名片创建 - [P0环境解耦] 客户端解耦本地硬编码:request.uts 支持 api_base_url 本地覆盖,生产数据库名修正为 crmmpdata - [P1高并发削峰] 雷达足迹批量缓冲引擎:引入 CrmRadarBufferService 环形缓冲队列与阈值/定时批量 Bulk Insert 落盘 - [P2中枢租户化] AI 智能中枢多租户 BYOK 与 Token 成本风控:支持企业自带 Key 隔离、Token 消耗账本、用量配额门禁与名片人设个性化联动 - [跨端规范] 对齐 Uni-app x 移动微官网原生首屏与底部原生 tabBar 规范 - [测试驱动] 全工程 116 个测试套件,1,175 个单元与集成测试用例全部 100% 绿色通过,管理后台 Vite 打包无错误
80 行
2.5 KiB
TypeScript
80 行
2.5 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';
|
|
|
|
const adminRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const layoutPath = path.join(adminRoot, 'src/layout.tsx');
|
|
const routesPath = path.join(adminRoot, 'src/routes.ts');
|
|
|
|
const CORE_BIZ_MODULES = [
|
|
'dashboard',
|
|
'card',
|
|
'crm',
|
|
'ai',
|
|
'nfc',
|
|
'team',
|
|
'settings-biz',
|
|
];
|
|
|
|
const REMOVED_DEMO_MODULES = [
|
|
'visualization',
|
|
'list',
|
|
'form',
|
|
'profile',
|
|
'result',
|
|
'user',
|
|
];
|
|
|
|
test('1. 核心出海业务菜单必须保留在侧边栏正常展示', () => {
|
|
const content = fs.readFileSync(routesPath, 'utf-8');
|
|
for (const key of CORE_BIZ_MODULES) {
|
|
assert.ok(
|
|
content.includes(`key: '${key}'`),
|
|
`routes.ts 必须存在核心业务模块: ${key}`
|
|
);
|
|
}
|
|
assert.ok(
|
|
!/key:\s*'dashboard'[\s\S]{0,80}ignore:\s*true/.test(content),
|
|
'dashboard 不得被 ignore'
|
|
);
|
|
});
|
|
|
|
test('2. Arco Pro Demo 模块必须从路由中移除,且 monitor / 个人中心不得再出现', () => {
|
|
const content = fs.readFileSync(routesPath, 'utf-8');
|
|
for (const key of REMOVED_DEMO_MODULES) {
|
|
assert.ok(
|
|
!content.includes(`key: '${key}'`),
|
|
`与需求无关的模板模块 ${key} 必须从 routes.ts 删除`
|
|
);
|
|
}
|
|
assert.ok(
|
|
!content.includes("key: 'dashboard/monitor'"),
|
|
'直播监控 Demo 必须从路由删除'
|
|
);
|
|
assert.ok(
|
|
!content.includes("key: 'user/info'"),
|
|
'个人中心 Demo 必须从路由删除'
|
|
);
|
|
});
|
|
|
|
test('3. layout 不得再为 ignore Demo 注册可访问路由,未知地址走 404', () => {
|
|
const content = fs.readFileSync(layoutPath, 'utf-8');
|
|
assert.ok(content.includes('KEEP_IGNORED_ROUTES'), '必须显式白名单详情/异常页');
|
|
assert.ok(content.includes('crm/lead-profile'), '线索画像必须仍可直达');
|
|
assert.ok(
|
|
content.includes("./pages/exception/404"),
|
|
'未知路由必须落到 404'
|
|
);
|
|
assert.ok(content.includes("'card'"), "layout.tsx 必须为 'card' 模块配置图标");
|
|
assert.ok(content.includes("'crm'"), "layout.tsx 必须为 'crm' 模块配置图标");
|
|
assert.ok(content.includes("'ai'"), "layout.tsx 必须为 'ai' 模块配置图标");
|
|
assert.ok(content.includes("'nfc'"), "layout.tsx 必须为 'nfc' 模块配置图标");
|
|
assert.ok(content.includes("'team'"), "layout.tsx 必须为 'team' 模块配置图标");
|
|
assert.ok(
|
|
content.includes("'settings-biz'"),
|
|
"layout.tsx 必须为 'settings-biz' 模块配置图标"
|
|
);
|
|
});
|