- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换 - 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片 - 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转 - 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出 - 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志 - 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票 - 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏 - 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
137 行
5.1 KiB
TypeScript
137 行
5.1 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 billingPagePath = path.join(
|
|
adminRoot,
|
|
'src/pages/settings/billing/index.tsx'
|
|
);
|
|
const billingLocalePath = path.join(
|
|
adminRoot,
|
|
'src/pages/settings/billing/locale/index.ts'
|
|
);
|
|
|
|
function readPage(): string {
|
|
assert.ok(fs.existsSync(billingPagePath), '订阅账单页面必须存在');
|
|
return fs.readFileSync(billingPagePath, 'utf-8');
|
|
}
|
|
|
|
function readLocale(): string {
|
|
assert.ok(fs.existsSync(billingLocalePath), '订阅账单语言包必须存在');
|
|
return fs.readFileSync(billingLocalePath, 'utf-8');
|
|
}
|
|
|
|
test('1. settings/billing 必须请求 billing/currentPlan', () => {
|
|
const content = readPage();
|
|
|
|
assert.ok(
|
|
content.includes('billing/currentPlan'),
|
|
'必须请求 POST /api/admin/team/billing/currentPlan'
|
|
);
|
|
assert.ok(
|
|
content.includes('admin/team/billing/currentPlan'),
|
|
'必须请求完整后台路径 /api/admin/team/billing/currentPlan'
|
|
);
|
|
assert.ok(content.includes('axios'), '必须使用 axios 发请求');
|
|
assert.ok(
|
|
content.includes('{}'),
|
|
'进入页必须 POST currentPlan {}'
|
|
);
|
|
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('BillingQuota'), '必须使用 BillingQuota 类型');
|
|
assert.ok(content.includes('TenantPlanType'), '必须使用 TenantPlanType 类型');
|
|
assert.ok(content.includes("from '@/types/omni'"), '必须复用 admin/src/types/omni.ts');
|
|
assert.ok(
|
|
!content.includes('Mock.js') && !content.includes("from 'mockjs'"),
|
|
'禁止用 Mock.js 假数据冒充成功'
|
|
);
|
|
assert.ok(!/\bany\b/.test(content), '禁止使用 any');
|
|
assert.ok(
|
|
!content.includes('stripe.com') && !content.includes('sk_live'),
|
|
'源码不含 stripe.com 或 sk_live'
|
|
);
|
|
});
|
|
|
|
test('2. settings/billing 必须使用 Card / Progress / Tag', () => {
|
|
const content = readPage();
|
|
|
|
assert.ok(content.includes('Card'), '必须使用 Arco Card');
|
|
assert.ok(content.includes('Progress'), '必须使用 Arco Progress');
|
|
assert.ok(content.includes('Tag'), '必须使用 Arco Tag');
|
|
assert.ok(content.includes('Alert'), '必须使用 Arco Alert 说明后续接入');
|
|
assert.ok(content.includes('planType'), 'Card 必须展示 planType');
|
|
assert.ok(content.includes('seatsUsed'), 'Progress 必须展示 seatsUsed');
|
|
assert.ok(content.includes('seatsLimit'), 'Progress 必须展示 seatsLimit');
|
|
assert.ok(content.includes('cardsUsed'), 'Progress 必须展示 cardsUsed');
|
|
assert.ok(content.includes('cardsLimit'), 'Progress 必须展示 cardsLimit');
|
|
assert.ok(content.includes("'free'"), '必须说明 free 套餐');
|
|
assert.ok(content.includes("'pro'"), '必须说明 pro 套餐');
|
|
assert.ok(content.includes("'enterprise'"), '必须说明 enterprise 套餐');
|
|
assert.ok(content.includes('lightColors'), '颜色必须引用 lightColors token');
|
|
assert.ok(content.includes('type="primary"'), '必须有一个主 CTA 刷新配额');
|
|
assert.ok(
|
|
!/#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})\b/.test(content),
|
|
'禁止硬编码颜色'
|
|
);
|
|
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');
|
|
assert.ok(
|
|
!content.includes('stripe.com') && !content.includes('sk_live'),
|
|
'源码不含 stripe.com 或 sk_live'
|
|
);
|
|
});
|
|
|
|
test('3. settings/billing locale 必须包含 menu.settings.billing', () => {
|
|
const content = readLocale();
|
|
|
|
assert.ok(
|
|
content.includes("'menu.settings.billing'"),
|
|
'页面语言包必须包含 menu.settings.billing'
|
|
);
|
|
assert.ok(content.includes("'en-US'"), '必须包含英文案');
|
|
assert.ok(content.includes("'zh-CN'"), '必须包含中文案');
|
|
assert.ok(
|
|
content.includes('settingsBilling.request.fail'),
|
|
'必须包含失败提示文案'
|
|
);
|
|
assert.ok(
|
|
content.includes('settingsBilling.action.refresh'),
|
|
'必须包含刷新配额主 CTA 文案'
|
|
);
|
|
assert.ok(
|
|
content.includes('settingsBilling.alert'),
|
|
'必须包含国际卡与发票后续接入提示'
|
|
);
|
|
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.ok(
|
|
!content.includes('stripe.com') && !content.includes('sk_live'),
|
|
'源码不含 stripe.com 或 sk_live'
|
|
);
|
|
|
|
assert.equal(defaultI18n['en-US']['menu.settings.billing'], 'Billing');
|
|
assert.equal(defaultI18n['zh-CN']['menu.settings.billing'], '订阅账单');
|
|
});
|