修复test.ts的引用

This commit is contained in:
luying
2022-04-09 11:04:28 +08:00
parent 12d47ec881
commit a23759335e
3 changed files with 27 additions and 27 deletions

View File

@@ -1,11 +1,11 @@
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_PRIVATE_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS, HERO_GROW_MAX, ABI_STAGE } from './../app/consts';
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, PUSH_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS, HERO_GROW_MAX, ABI_STAGE } from './../app/consts';
import { Client } from './Client';
import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { checkSuccessResponse } from './CheckPatten';
const TEXT_MSG = { type: MSG_TYPE.TEXT, content: 'hello world' }
const TEXT_MSG = { type: MSG_TYPE.TEXT, content: 'hello' }
const LVBU_HID = 44;
const XIAHOUQINGYI_HID = 53;
@@ -42,12 +42,12 @@ function checkHeroInfoStr(content: string) {
function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: PinusWSClient, channel: string, channelId: string, done: Mocha.Done) {
let msgReceiveCnt = 0;
const roomId = `${channel}_${channelId}`;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
checkGroupMsg(res.data, roleInfo.roleId, roomId, TEXT_MSG.content);
msgReceiveCnt += 1;
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
checkGroupMsg(res.data, roleInfo.roleId, roomId, TEXT_MSG.content);
msgReceiveCnt += 1;
@@ -57,8 +57,8 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
checkSuccessResponse(res, false);
setTimeout(() => {
expect(msgReceiveCnt).to.be.equal(2);
pinusClientT.off(ON_GROUP_MSG_ROUTE);
pinusClient.off(ON_GROUP_MSG_ROUTE);
pinusClientT.off(PUSH_ROUTE.GROUP_MSG);
pinusClient.off(PUSH_ROUTE.GROUP_MSG);
done();
}, 2000);
});
@@ -67,12 +67,12 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
// function testHeroPush(pinusClient: PinusWSClient, pinusClientT: PinusWSClient, hid: number, route: string, routeParam: object, done: Mocha.Done) {
// let msgReceiveCnt = 0;
// pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
// pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
// checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
// msgReceiveCnt += 1;
// });
// pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
// pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
// checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
// msgReceiveCnt += 1;
@@ -124,7 +124,7 @@ describe('聊天测试', function () {
});
it('两个玩家互相发送', function (done) {
pinusClientT.on(ON_PRIVATE_MSG_ROUTE, (msg) => {
pinusClientT.on(PUSH_ROUTE.PRIVATE_MSG, (msg) => {
checkSuccessResponse(msg);
expect(msg.data.content).to.equal(TEXT_MSG.content);
});
@@ -196,12 +196,12 @@ describe('聊天测试', function () {
it('测试系统频道橙将合成消息', function (done) {
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
@@ -214,8 +214,8 @@ describe('聊天测试', function () {
checkSuccessResponse(composeRes);
setTimeout(() => {
expect(msgReceiveCnt).to.be.equal(2);
pinusClientT.off(ON_GROUP_MSG_ROUTE);
pinusClient.off(ON_GROUP_MSG_ROUTE);
pinusClientT.off(PUSH_ROUTE.GROUP_MSG);
pinusClient.off(PUSH_ROUTE.GROUP_MSG);
done();
}, 1000);
});
@@ -225,12 +225,12 @@ describe('聊天测试', function () {
// 材料不足先跳过
it.skip('测试系统频道升六星消息', function (done) {
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
@@ -267,10 +267,10 @@ describe('聊天测试', function () {
// checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
}
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkHeroInfoRes(res);
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkHeroInfoRes(res);
});
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: XIAHOUQINGYI_HID }, (cleanUpRes) => {
@@ -337,10 +337,10 @@ describe('聊天测试', function () {
expect(res.data.content).to.be.equal(newNotice);
msgReceiveCnt += 1;
}
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClientT.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkNoticeRes(res);
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
pinusClient.on(PUSH_ROUTE.GROUP_MSG, (res) => {
checkNoticeRes(res);
});
pinusClient.request('guild.guildHandler.getMyGuildInfo', {}, (res) => {
@@ -359,8 +359,8 @@ describe('聊天测试', function () {
expect(setRes.data.notice).to.be.equal(newNotice);
setTimeout(() => {
expect(msgReceiveCnt).to.be.equal(2);
pinusClientT.off(ON_GROUP_MSG_ROUTE);
pinusClient.off(ON_GROUP_MSG_ROUTE);
pinusClientT.off(PUSH_ROUTE.GROUP_MSG);
pinusClient.off(PUSH_ROUTE.GROUP_MSG);
done();
}, 500);
});