聊天:获取私聊历史消息
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { MSG_TYPE, ON_MSG_ROUTE } from './../app/consts';
|
||||
import { PrivateMessageParam, PrivateMessageType } from './../app/db/PrivateMessage';
|
||||
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE } from './../app/consts';
|
||||
import { indexOf } from 'underscore';
|
||||
import { COM_TEAM_STATUS, DEFAULT_HEROES } from './../../shared/consts/consts';
|
||||
import { Client } from './Client';
|
||||
@@ -16,7 +17,7 @@ function sendPrivateMessageParm(targetRoleInfo, msg) {
|
||||
return result;
|
||||
}
|
||||
|
||||
describe('私聊消息发送和接收', function() {
|
||||
describe('聊天测试', function() {
|
||||
let pinusClient: PinusWSClient;
|
||||
let pinusClientT: PinusWSClient; // 用做测试队友
|
||||
let roleInfo;
|
||||
@@ -58,4 +59,22 @@ describe('私聊消息发送和接收', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('获取私聊历史消息', function(done) {
|
||||
for (let i = 0; i < DEFAULT_MSG_PER_PAGE; i++) {
|
||||
pinusClient.request('chat.chatHandler.sendPrivateMessage', sendPrivateMessageParm(roleInfoT, TEXT_MSG), (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
pinusClient.request('chat.chatHandler.getPrivateMessage', {targetRoleId: roleInfoT.roleId}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.msgs).to.be.an('array');
|
||||
expect(res.data.msgs.length).to.be.equal(DEFAULT_MSG_PER_PAGE);
|
||||
res.data.msgs.forEach(msg => {
|
||||
expect(msg.content).to.equal(TEXT_MSG.content);
|
||||
});
|
||||
done();
|
||||
})
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user