聊天:军团修改公告的推送和测试

This commit is contained in:
liangtongchuan
2021-03-09 17:02:23 +08:00
parent 109d643544
commit 130bbc3be6
4 changed files with 60 additions and 7 deletions

View File

@@ -216,18 +216,18 @@ describe('聊天测试', function() {
});
});
// TODO: 升品推送测试
it('测试系统频道升品消息', function(done) {
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
function checkHeroInfoRes(res) {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
}
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
checkHeroInfoRes(res);
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
checkHeroInfoRes(res);
});
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: XIAHOUQINGYI_HID }, (cleanUpRes) => {
if (cleanUpRes.code !== STATUS.HERO_NOT_FIND.code) {
@@ -270,4 +270,41 @@ describe('聊天测试', function() {
it('测试军团频道消息', function(done) {
testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.GUILD, roleInfo.guildCode, done);
});
it('测试军团通知修改推送', function(done) {
const newNotice = new Date().toLocaleDateString();
let msgReceiveCnt = 0;
function checkNoticeRes(res) {
checkSuccessResponse(res);
expect(res.data.content).to.be.equal(newNotice);
msgReceiveCnt += 1;
}
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
checkNoticeRes(res);
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
checkNoticeRes(res);
});
pinusClient.request('battle.guildHandler.getMyGuildInfo', { }, (res) => {
checkSuccessResponse(res);
expect(res.data).to.have.deep.property('hasGuild').that.is.an('boolean');
if(res.data.hasGuild) {
expect(res.data).to.have.deep.property('code').that.is.an('string');
expect(res.data).to.have.deep.property('name').that.is.an('string');
expect(res.data).to.have.deep.property('notice').that.is.an('string');
expect(res.data).to.have.deep.property('introduce').that.is.an('string');
expect(res.data).to.have.deep.property('ceLimit').that.is.an('number');
expect(res.data).to.have.deep.property('isAuto').that.is.an('boolean');
const { code, name, notice, introduce, ceLimit, isAuto } = res.data;
pinusClient.request('battle.guildHandler.setGuildInfo', { code, name, notice: newNotice, introduce, ceLimit, isAuto }, (setRes) => {
checkSuccessResponse(setRes);
expect(setRes.data.notice).to.be.equal(newNotice);
setTimeout(() => {
expect(msgReceiveCnt).to.be.equal(2);
done();
}, 50);
});
}
});
});
});