29 行
1.2 KiB
TypeScript
29 行
1.2 KiB
TypeScript
// 已读取AGENTS.md
|
||
import * as fs from 'fs';
|
||
import * as path from 'path';
|
||
|
||
/**
|
||
* 第五十一批回归闸门:管理员用户360画像按 id 精确关联
|
||
*/
|
||
describe('第五十一批用户360画像关联闸门', () => {
|
||
const rootDir = path.resolve(__dirname, '../../');
|
||
const repoCode = fs.readFileSync(path.join(rootDir, 'server/src/db/repository.ts'), 'utf-8');
|
||
|
||
it('订单按 buyer/expert/claimed/companion(user_id) 关联', () => {
|
||
const start = repoCode.indexOf('async getUserDetail(');
|
||
expect(start).toBeGreaterThan(-1);
|
||
const block = repoCode.slice(start, start + 3000);
|
||
expect(block).toContain('OR expert_id IN (SELECT id FROM companions WHERE user_id = ?)');
|
||
expect(block).toContain('OR companion_name IN (SELECT name FROM companions WHERE user_id = ?)');
|
||
expect(block).not.toContain('user_id = ? OR id = ?');
|
||
expect(block).not.toContain('WHERE client_name = ? OR companion_name = ?');
|
||
});
|
||
|
||
it('资金流水按 user_id 精确归属', () => {
|
||
const start = repoCode.indexOf('async getUserDetail(');
|
||
const block = repoCode.slice(start, start + 3200);
|
||
expect(block).toContain('WHERE user_id = ?');
|
||
expect(block).not.toContain('counterparty LIKE ? OR counterparty LIKE ?');
|
||
});
|
||
});
|