feat(safety): add expert skill tags and price range constraints configuration

这个提交包含在:
xcbyy
2026-10-10 13:56:38 +08:00
父节点 2e726e125d
当前提交 d7f5c31762
共有 5 个文件被更改,包括 351 次插入 和 5 次删除

查看文件

@@ -185,5 +185,41 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安
expect(indexContent).toContain('HomePopupModal');
});
});
describe('6. 大神技能标签库与定价区间规范配置校验 (expert_rules)', () => {
it('MySQL 数据库与种子数据必须注册 expert_rules 配置项且字段完整', () => {
const mysqlPath = path.join(rootDir, 'server', 'src', 'db', 'mysql.ts');
const content = fs.readFileSync(mysqlPath, 'utf-8');
expect(content).toContain('expert_rules');
expect(content).toContain('minHourlyRate');
expect(content).toContain('maxHourlyRate');
expect(content).toContain('candidateTags');
});
it('管理后台 platform-config 必须包含 Tab 8 大神资质与定价规则可视化面板', () => {
const adminConfigPath = path.join(rootDir, 'admin', 'arco-design-pro-vite', 'src', 'views', 'safety', 'platform-config', 'index.vue');
const content = fs.readFileSync(adminConfigPath, 'utf-8');
expect(content).toContain('expert_rules_config');
expect(content).toContain('大神资质与定价规则');
expect(content).toContain('expertRulesForm');
expect(content).toContain('expertCandidateTags');
});
it('服务端路由必须提供 PUT /api/companions/:id 接口并强校验价格上下限与敏感标签', () => {
const serverIndexPath = path.join(rootDir, 'server', 'src', 'index.ts');
const content = fs.readFileSync(serverIndexPath, 'utf-8');
expect(content).toContain("app.put('/api/companions/:id'");
expect(content).toContain('minHourlyRate');
expect(content).toContain('maxHourlyRate');
expect(content).toContain('contentSecurityService.checkText');
});
it('测试套件与新增代码严禁任何 Emoji 违规', () => {
const serverIndexPath = path.join(rootDir, 'server', 'src', 'index.ts');
const content = fs.readFileSync(serverIndexPath, 'utf-8');
const emojiRegex = /(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u2600-\u27BF])/u;
expect(emojiRegex.test(content)).toBe(false);
});
});
});