文件
OmniCard/admin/tests/crm-pipeline.test.ts
wikiboss eec259a3a7 feat: 完成全系统30个功能点开发与E2E全链路验收 (8轮调度32个子代理闭环)
- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换
- 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片
- 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转
- 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出
- 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志
- 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票
- 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏
- 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
2026-09-20 23:47:47 +08:00

85 行
3.9 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 pipelinePagePath = path.join(adminRoot, 'src/pages/crm/pipeline/index.tsx');
const pipelineLocalePath = path.join(
adminRoot,
'src/pages/crm/pipeline/locale/index.ts'
);
test('1. crm/pipeline 必须请求 lead/page 与 updateStatus,并用 Arco Grid/Card', () => {
assert.ok(fs.existsSync(pipelinePagePath), '商机看板页面必须存在');
const content = fs.readFileSync(pipelinePagePath, 'utf-8');
assert.ok(
content.includes('admin/crm/lead/page'),
'必须请求 POST /api/admin/crm/lead/page'
);
assert.ok(
content.includes('admin/crm/lead/updateStatus'),
'必须请求 POST /api/admin/crm/lead/updateStatus'
);
assert.ok(content.includes('Grid'), '必须使用 Arco Grid');
assert.ok(content.includes('Card'), '必须使用 Arco Card');
assert.ok(content.includes('Select'), '状态流转必须使用 Arco Select');
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('100'), '必须按 size=100 拉一批');
assert.ok(
!content.includes('Mock.js') && !content.includes("from 'mockjs'"),
'禁止用 Mock.js 假数据冒充成功'
);
assert.ok(!/\bany\b/.test(content), '禁止使用 any');
assert.ok(
!content.includes('react-beautiful-dnd') &&
!content.includes('dnd-kit') &&
!content.includes('react-dnd'),
'禁止自制或引入拖拽库'
);
});
test('2. crm/pipeline 必须复用 LeadEntity 并渲染五列状态看板', () => {
const content = fs.readFileSync(pipelinePagePath, 'utf-8');
assert.ok(content.includes('LeadEntity'), '必须使用 LeadEntity 类型');
assert.ok(content.includes('LeadStatus'), '必须使用 LeadStatus 类型');
assert.ok(content.includes("from '@/types/omni'"), '必须复用 omni 契约');
assert.ok(content.includes('lightColors'), '颜色必须引用 lightColors');
assert.ok(content.includes('Form'), '必须使用 Arco Form');
assert.ok(content.includes('name'), '卡片必须展示 name');
assert.ok(content.includes('company'), '卡片必须展示 company');
assert.ok(content.includes('intentScore'), '卡片必须展示 intentScore');
assert.ok(content.includes('source'), '卡片必须展示 source');
assert.ok(content.includes('cardId'), '必须支持 cardId 筛选');
assert.ok(content.includes('keyWord'), '必须支持 keyWord 筛选');
assert.ok(content.includes('id') && content.includes('status'), 'updateStatus 必须传 id 与 status');
for (const status of ['new', 'contacted', 'hot', 'won', 'archived']) {
assert.ok(content.includes(`'${status}'`), `必须支持状态列: ${status}`);
}
});
test('3. crm/pipeline locale 必须包含 menu.crm.pipeline 与看板文案', () => {
assert.ok(fs.existsSync(pipelineLocalePath), '商机看板语言包必须存在');
const content = fs.readFileSync(pipelineLocalePath, 'utf-8');
assert.ok(content.includes("'menu.crm.pipeline'"), '页面语言包必须包含 menu.crm.pipeline');
assert.ok(content.includes('crmPipeline.request.fail'), '必须包含失败提示文案');
assert.ok(content.includes('crmPipeline.form.refresh'), '必须包含刷新主 CTA 文案');
assert.ok(content.includes('crmPipeline.column.empty'), '必须包含空列文案');
assert.ok(content.includes('crmPipeline.status.new'), '必须包含状态文案');
assert.ok(content.includes('crmPipeline.status.archived'), '必须包含归档状态文案');
assert.ok(!/\bany\b/.test(content), 'locale 禁止使用 any');
});