// 已读取AGENTS.md import * as fs from 'fs'; import * as path from 'path'; /** * 第六十六批回归闸门:去"合成虚拟大神"假数据 */ describe('第六十六批大神档案真实性闸门', () => { const rootDir = path.resolve(__dirname, '../../'); const repoCode = fs.readFileSync(path.join(rootDir, 'server/src/db/repository.ts'), 'utf-8'); const detail = fs.readFileSync(path.join(rootDir, 'pwuniapp/pages/expert/detail.vue'), 'utf-8'); const synthBlock = () => { const start = repoCode.indexOf('async getCompanionById('); expect(start).toBeGreaterThan(-1); return repoCode.slice(start, start + 9000); }; it('合成档案不再虚构评分/单量/价格/语音/状态', () => { const b = synthBlock(); expect(b).toContain('let synthetic = false;'); expect(b).toContain('synthetic = true;'); expect(b).toContain('rating: 0'); expect(b).toContain('order_count: 0'); expect(b).toContain('hourly_rate: 0'); expect(b).toContain("status: '休息中'"); expect(b).toContain("audit_status: '未申请'"); // 合成档案不返回服务包 expect(b).toContain('services: synthetic ? []'); // 标记是否为真实大神 expect(b).toContain('isCompanion: !synthetic'); }); it('小程序对非大神档案隐藏服务与预约并去除假默认值', () => { expect(detail).toContain('const isCompanion = computed('); expect(detail).toContain('v-if="isCompanion"'); expect(detail).toContain('该用户尚未认证为大神,暂不可预约'); expect(detail).not.toContain('rating: 5.0'); expect(detail).not.toContain('orderCount: 86'); expect(detail).not.toContain('price: 68'); }); });