聊天:组队聊天和测试
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { indexOf } from 'underscore';
|
||||
import { COM_TEAM_STATUS, DEFAULT_HEROES } from './../../shared/consts/consts';
|
||||
import { Client } from './Client';
|
||||
import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst';
|
||||
import 'mocha';
|
||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
import { expect } from 'chai';
|
||||
import { checkDisplayItems, checkSuccessResponse } from './CheckPatten';
|
||||
import { COM_TEAM_STATUS, DEFAULT_HEROES, MSG_TYPE, ON_GROUP_MSG_ROUTE } from '../app/consts';
|
||||
|
||||
/**
|
||||
* @description 组队后的战斗过程:队长开战 -> 设置阵容 -> 对默认敌人造成伤害 -> 获取战斗状态 -> 结算
|
||||
@@ -198,4 +197,55 @@ describe('寻宝创建队伍', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('组队文字聊天', function(done) {
|
||||
let msgReceiveCnt = 0;
|
||||
const MSG_CONTENT = 'hello teammate';
|
||||
|
||||
function checkMsg(msg) {
|
||||
expect(msg).to.be.an('object');
|
||||
expect(msg.content).to.be.equal(MSG_CONTENT);
|
||||
}
|
||||
|
||||
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkMsg(res.data);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkMsg(res.data);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
|
||||
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
|
||||
checkSuccessResponse(searchRes, false);
|
||||
if (!searchRes.data) {
|
||||
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.teamCode).to.be.a('string');
|
||||
expect(res.data.roleStatus).to.be.an('array');
|
||||
res.data.roleStatus.forEach(roleSt => {
|
||||
expect(roleSt).to.have.all.keys('roleId', 'roleName', 'isCap', 'isFrd', 'headHid', 'sHid', 'topLineupCe', 'lv', 'isRobot', 'heroes', 'killed', 'totalDmg', 'frdRatio');
|
||||
});
|
||||
const roleIds = res.data.roleStatus.map(roleSt => { return roleSt.roleId });
|
||||
if (roleIds.indexOf(roleInfoT.roleId) === -1) {
|
||||
console.warn('未测试到组队后的聊天');
|
||||
done();
|
||||
}
|
||||
pinusClient.request('battle.comBattleHandler.sendTeamMsg', {teamCode: res.data.teamCode, type: MSG_TYPE.TEXT, content: MSG_CONTENT}, (msgRes) => {
|
||||
checkSuccessResponse(msgRes, false);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
comBattleProcess(pinusClient, res.data.teamCode, done);
|
||||
}, 50);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.warn('未测试到组队后的聊天');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user