聊天:获得橙色武将推送系统消息
测试:增加删除武将等测试接口
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX } from './../app/consts';
|
||||
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS } from './../app/consts';
|
||||
import { Client } from './Client';
|
||||
import 'mocha';
|
||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
@@ -6,6 +6,8 @@ import { expect } from 'chai';
|
||||
import { checkSuccessResponse } from './CheckPatten';
|
||||
|
||||
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
|
||||
const LVBU_HID = 44;
|
||||
const LVBU_PIECE_ID = 21044;
|
||||
|
||||
function sendPrivateMessageParm(targetRoleInfo, msg) {
|
||||
const { roleId: targetRoleId, roleName: targetRoleName } = targetRoleInfo;
|
||||
@@ -19,12 +21,24 @@ function sendGroupMessageParm(channel, channelId, msg) {
|
||||
}
|
||||
|
||||
function checkGroupMsg(msg, roleId, roomId, content) {
|
||||
expect(msg.content).to.equal(TEXT_MSG.content);
|
||||
expect(msg.roleId).to.equal(roleId);
|
||||
expect(msg.content).to.equal(content);
|
||||
expect(msg.roomId).to.equal(roomId);
|
||||
}
|
||||
|
||||
function checkHeroInfoStr(content: string) {
|
||||
expect(content).to.be.a('string');
|
||||
const heroInfo = JSON.parse(content);
|
||||
expect(heroInfo).to.be.an('object');
|
||||
const { roleId, roleName, hero } = heroInfo;
|
||||
expect(roleId).to.be.a('string');
|
||||
expect(roleName).to.be.a('string');
|
||||
const { hid, seqId, hName } = hero;
|
||||
expect(hid).to.be.a('number');
|
||||
expect(seqId).to.be.a('number');
|
||||
expect(hName).to.be.a('string');
|
||||
}
|
||||
|
||||
function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: PinusWSClient, channel: string, channelId: string, done: Mocha.Done) {
|
||||
let msgReceiveCnt = 0;
|
||||
const roomId = `${channel}_${channelId}`;
|
||||
@@ -112,8 +126,35 @@ describe('聊天测试', function() {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
it('测试系统频道消息', function(done) {
|
||||
// TODO: 升品推送
|
||||
it('测试系统频道橙将合成消息', function(done) {
|
||||
const roomId = `${CHANNEL_PREFIX.SYS}_${roleInfo.serverId}`;
|
||||
let msgReceiveCnt = 0;
|
||||
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: LVBU_HID }, (cleanUpRes) => {
|
||||
if (cleanUpRes.code !== STATUS.HERO_NOT_FIND.code) {
|
||||
checkSuccessResponse(cleanUpRes, false);
|
||||
}
|
||||
pinusClient.request('role.heroHandler.compose', { hid: LVBU_HID }, (composeRes) => {
|
||||
checkSuccessResponse(composeRes);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
done();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: 升品推送测试
|
||||
it('测试系统频道升品消息', function(done) {
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user