🐞 fix(test): 修正部分测试用例
This commit is contained in:
@@ -52,13 +52,18 @@ describe('寻宝创建队伍', function() {
|
||||
beforeEach(function(done) {
|
||||
const c = new Client();
|
||||
const cT = new Client('13121622738');
|
||||
const timer = setInterval(() => {
|
||||
const timer = setInterval(async () => {
|
||||
if (c.client && cT.client) {
|
||||
pinusClient = c.client;
|
||||
roleInfo = c.roleInfo;
|
||||
pinusClientT = cT.client;
|
||||
roleInfoT = cT.roleInfo;
|
||||
clearInterval(timer);
|
||||
// 创建寻宝队伍有等级限制,最小20级,把玩家等级调整到20级
|
||||
// battle.comBattleHandler.searchTeam 需要在searchTeam之前调整
|
||||
// comBattle中有多个位置需要设置,索性这里操作一次
|
||||
await debugSetRoleLv(pinusClientT);
|
||||
await debugSetRoleLv(pinusClient);
|
||||
done();
|
||||
}
|
||||
}, 1000);
|
||||
@@ -286,3 +291,21 @@ describe('寻宝创建队伍', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// debugSetRoleLv - 设置用户等级
|
||||
async function debugSetRoleLv(client: PinusWSClient) {
|
||||
// 更新用户等级 - 范围[20,100]
|
||||
const minRoleLv = 20;
|
||||
return new Promise((resolve, reject) => {
|
||||
client.request('battle.comBattleHandler.debugSetRoleLv', { targetLv: minRoleLv }, (res) => {
|
||||
// res.data: { lv: 20, roleId: 'g9Hgrjk6Kh' }
|
||||
if (res.data.lv == minRoleLv) {
|
||||
// console.log(`更新 ${res.data.roleId} 到 ${res.data.lv}`);
|
||||
resolve('success');
|
||||
} else {
|
||||
reject(new Error(`更新 ${res.data.roleId} 失败`));
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user