From 99d1c018e6f8f703369402a8672fee0e0b949566 Mon Sep 17 00:00:00 2001 From: xcbyy <2578898740@qq.com> Date: Mon, 19 Oct 2026 09:19:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E5=86=92=E7=83=9F=E8=84=9A=E6=9C=AC=20smoke-batch66.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smoke-batch66.ts | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 smoke-batch66.ts diff --git a/smoke-batch66.ts b/smoke-batch66.ts deleted file mode 100644 index c145f22..0000000 --- a/smoke-batch66.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { initDatabase, pool } from './server/src/db/mysql'; -import { repo } from './server/src/db/repository'; - -async function main() { - await initDatabase(); - const stamp = Date.now(); - const uid = (stamp % 800000000) + 100000001; - - const results: Array<[string, boolean, string]> = []; - const check = (name: string, ok: boolean, detail = '') => results.push([name, ok, detail]); - - try { - await pool.query( - `INSERT INTO users (id, user_no, nickname, avatar, phone, gender, role, balance, order_count, status) - VALUES (?, ?, 'smoke-plain-user', '', '13100001111', '保密', '普通玩家', 0, 5, '正常')`, - [uid, `SMPU${stamp}`] - ); - - const p: any = await repo.getCompanionById(uid); - check('普通用户档案标记 isCompanion=false', p && p.isCompanion === false, JSON.stringify({ isCompanion: p && p.isCompanion })); - check('评分不再虚构(0)', Number(p.rating) === 0, String(p && p.rating)); - check('单量不再虚构(0)', Number(p.orderCount) === 0, String(p && p.orderCount)); - check('价格不再虚构(0)', Number(p.price) === 0, String(p && p.price)); - check('不返回虚构服务包', Array.isArray(p.services) && p.services.length === 0, JSON.stringify(p && p.services)); - check('状态为休息中', p.status === '休息中', String(p && p.status)); - check('审核状态为未申请', p.auditStatus === '未申请', String(p && p.auditStatus)); - } finally { - await pool.query('DELETE FROM companions WHERE user_id = ?', [uid]); - await pool.query('DELETE FROM users WHERE id = ?', [uid]); - } - - let allPass = true; - for (const [n, ok, detail] of results) { - if (!ok) allPass = false; - console.log(`${ok ? 'PASS' : 'FAIL'} ${n} ${detail}`); - } - console.log(allPass ? '\nBATCH66 SMOKE: ALL PASS' : '\nBATCH66 SMOKE: FAILED'); - await pool.end(); - process.exit(allPass ? 0 : 1); -} - -main().catch((e) => { - console.error('SMOKE ERROR', e); - process.exit(2); -});