From 49024c5aa005a0d56971ad92aa619ff152cb1d28 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Mon, 8 Feb 2021 16:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BB=E5=AE=9D=E6=B5=8B=E8=AF=95=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=A4=E4=B8=AA=E7=AE=80=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/handler/comBattleHandler.ts | 5 +- game-server/test/comBattle.test.ts | 48 +++++++++++++++---- game-server/test/guild.test.ts | 2 +- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/game-server/app/servers/battle/handler/comBattleHandler.ts b/game-server/app/servers/battle/handler/comBattleHandler.ts index b996a2307..24f55a670 100644 --- a/game-server/app/servers/battle/handler/comBattleHandler.ts +++ b/game-server/app/servers/battle/handler/comBattleHandler.ts @@ -397,7 +397,7 @@ export class ComBattleHandler { } /** - * 获取队伍列表-deprecated + * ! 获取队伍列表-deprecated * @param msg * @param session */ @@ -411,7 +411,8 @@ export class ComBattleHandler { } /** - * @description 队伍准备-deprecate + * ! deprecate + * @description 队伍准备 * @param {{teamCode: string, heroes: Array}} msg * @param {BackendSession} session * @returns diff --git a/game-server/test/comBattle.test.ts b/game-server/test/comBattle.test.ts index 57c3cef36..04bc4929e 100644 --- a/game-server/test/comBattle.test.ts +++ b/game-server/test/comBattle.test.ts @@ -1,3 +1,4 @@ +import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst'; import 'mocha'; import { PinusWSClient, PinusWSClientEvent } from 'pinus-robot-plugin'; import { expect } from 'chai'; @@ -15,7 +16,7 @@ describe('寻宝创建队伍', function() { const loginParms = {serverId: 1}; const createTeamParms = {blueprtId: 33001, pub: true, ceLimit: 0}; - const searchTeamParms = {qualityArr: [1, 2, 3, 4, 5]}; + const searchTeamParms = {qualityArr: COM_BTL_QUALITY}; beforeEach(function(done) { pinusClient = new PinusWSClient(); @@ -85,15 +86,42 @@ describe('寻宝创建队伍', function() { }); }); - // it('加入队伍,机器人的话直接开战', function(done) { - // this.timeout(65 * 1000); - // pinusClient.request('battle.comBattleHandler.searchTeam', searchTeamParms, (res) => { - // expect(res).to.be.an('object'); - // expect(res.code).equal(0); - // expect(res.data).to.be.an('object'); - // expect(res.data.teamCode).to.be.a('string'); - // }); - // }); + it('搜索队伍再取消', function(done) { + pinusClient.request('battle.comBattleHandler.searchTeam', searchTeamParms, (res) => { + expect(res).to.be.an('object'); + expect(res.code).equal(0); + if (!res.data) { + pinusClient.request('battle.comBattleHandler.cancelSearch', {}, (cancelRes) => { + expect(cancelRes).to.be.an('object'); + expect(cancelRes.code).equal(0); + done(); + }); + } else { + expect(res.data).to.be.an('object'); + expect(res.data.teamCode).to.be.a('string'); + done(); + } + }); + }); + + it('查询可招募或助战的次数', function(done) { + pinusClient.request('battle.comBattleHandler.getComBtlCnt', {}, (res) => { + expect(res).to.be.an('object'); + expect(res.code).equal(0); + expect(res.data).to.be.an('object'); + console.log('getComBtlCnt', res.data); + expect(res.data.assistCnt).to.be.an('array'); + res.data.assistCnt.forEach(cnt => { + expect(cnt).to.be.a('number'); + }); + expect(res.data.blueprts).to.be.an('array'); + res.data.blueprts.forEach(item => { + expect(item.id).to.be.a('number'); + expect(item.count).to.be.a('number'); + }); + done(); + }); + }); it('获取寻宝记录', function(done) { pinusClient.request('battle.comBattleHandler.getTeamRec', {}, (res) => { diff --git a/game-server/test/guild.test.ts b/game-server/test/guild.test.ts index dad56b93b..f27cfa7be 100644 --- a/game-server/test/guild.test.ts +++ b/game-server/test/guild.test.ts @@ -67,7 +67,7 @@ describe('军团测试', function() { it('获取军团列表', function(done) { pinusClient.request('battle.guildHandler.getGuildList', {page:1, showPeopleMax: true, name: ""} , (res) => { - console.log(JSON.stringify(res)) + // console.log(JSON.stringify(res)) // 消息回调 expect(res).to.be.an('object'); expect(res.code).equal(0);