测试:删掉部分注释,修改用例名
This commit is contained in:
@@ -15,13 +15,13 @@ export class Client {
|
|||||||
port: port
|
port: port
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
// 连接成功执行函数
|
// 连接成功执行函数
|
||||||
console.log('gate连接成功');
|
// console.log('gate连接成功');
|
||||||
this._client.request('connector.entryHandler.debugQueryToken', {tel, magicWord: 'zyz666server518'}, (res) => {
|
this._client.request('connector.entryHandler.debugQueryToken', {tel, magicWord: 'zyz666server518'}, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
expect(res.data.token).to.be.an('string');
|
expect(res.data.token).to.be.an('string');
|
||||||
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (enterRes) => {
|
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (enterRes) => {
|
||||||
// 消息回调
|
// 消息回调
|
||||||
console.log('connector返回');
|
// console.log('connector返回');
|
||||||
checkSuccessResponse(enterRes);
|
checkSuccessResponse(enterRes);
|
||||||
expect(enterRes.data.role).to.be.an('object');
|
expect(enterRes.data.role).to.be.an('object');
|
||||||
this._roleInfo = enterRes.data.role;
|
this._roleInfo = enterRes.data.role;
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class PinusWSClient {
|
|||||||
this.handlers[Package.TYPE_KICK] = this.onKick;
|
this.handlers[Package.TYPE_KICK] = this.onKick;
|
||||||
}
|
}
|
||||||
init(params, cb) {
|
init(params, cb) {
|
||||||
console.log('init', params);
|
if (PinusWSClient.DEBUG) {
|
||||||
|
console.log('init', params);
|
||||||
|
}
|
||||||
this.initCallback = cb;
|
this.initCallback = cb;
|
||||||
let host = params.host;
|
let host = params.host;
|
||||||
let port = params.port;
|
let port = params.port;
|
||||||
@@ -74,7 +76,9 @@ class PinusWSClient {
|
|||||||
this.initWebSocket(host, port, cb);
|
this.initWebSocket(host, port, cb);
|
||||||
}
|
}
|
||||||
initWebSocket(host, port, cb) {
|
initWebSocket(host, port, cb) {
|
||||||
console.log('[Pinus] connect to:', host, port);
|
if (PinusWSClient.DEBUG) {
|
||||||
|
console.log('[Pinus] connect to:', host, port);
|
||||||
|
}
|
||||||
let url = 'ws://' + host;
|
let url = 'ws://' + host;
|
||||||
if (port) {
|
if (port) {
|
||||||
url += ':' + port;
|
url += ':' + port;
|
||||||
@@ -135,11 +139,15 @@ class PinusWSClient {
|
|||||||
this.send(byte);
|
this.send(byte);
|
||||||
}
|
}
|
||||||
onConnect() {
|
onConnect() {
|
||||||
console.log('[Pinus] connect success');
|
if (PinusWSClient.DEBUG) {
|
||||||
|
console.log('[Pinus] connect success');
|
||||||
|
}
|
||||||
this.send(this._package.encode(Package.TYPE_HANDSHAKE, Protocol.strencode(JSON.stringify(this.handshakeBuffer))));
|
this.send(this._package.encode(Package.TYPE_HANDSHAKE, Protocol.strencode(JSON.stringify(this.handshakeBuffer))));
|
||||||
}
|
}
|
||||||
onClose(e) {
|
onClose(e) {
|
||||||
console.error('[Pinus] connect close');
|
if (PinusWSClient.DEBUG) {
|
||||||
|
console.error('[Pinus] connect close');
|
||||||
|
}
|
||||||
// this.emit(Pinus.EVENT_CLOSE,e);
|
// this.emit(Pinus.EVENT_CLOSE,e);
|
||||||
}
|
}
|
||||||
onIOError(e) {
|
onIOError(e) {
|
||||||
@@ -260,7 +268,9 @@ class PinusWSClient {
|
|||||||
this._disconnect();
|
this._disconnect();
|
||||||
}
|
}
|
||||||
_disconnect() {
|
_disconnect() {
|
||||||
console.warn('[Pinus] client disconnect ...');
|
if (PinusWSClient.DEBUG) {
|
||||||
|
console.warn('[Pinus] client disconnect ...');
|
||||||
|
}
|
||||||
if (this.socket)
|
if (this.socket)
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
this.socket = null;
|
this.socket = null;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'mocha';
|
|||||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { Client } from './Client';
|
import { Client } from './Client';
|
||||||
describe('test zyz login', function() {
|
describe('测试赵云传登录', function() {
|
||||||
let pinusClient: PinusWSClient;
|
let pinusClient: PinusWSClient;
|
||||||
|
|
||||||
afterEach(function(done) {
|
afterEach(function(done) {
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import { PrivateMessageParam, PrivateMessageType } from './../app/db/PrivateMessage';
|
|
||||||
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE } from './../app/consts';
|
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';
|
import { Client } from './Client';
|
||||||
import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst';
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { checkDisplayItems, checkSuccessResponse } from './CheckPatten';
|
import { checkSuccessResponse } from './CheckPatten';
|
||||||
|
|
||||||
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
|
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
|
||||||
|
|
||||||
@@ -46,7 +42,6 @@ describe('聊天测试', function() {
|
|||||||
|
|
||||||
it('两个玩家互相发送', function(done) {
|
it('两个玩家互相发送', function(done) {
|
||||||
pinusClientT.on(ON_MSG_ROUTE, (msg) => {
|
pinusClientT.on(ON_MSG_ROUTE, (msg) => {
|
||||||
console.log(ON_MSG_ROUTE , msg);
|
|
||||||
checkSuccessResponse(msg);
|
checkSuccessResponse(msg);
|
||||||
expect(msg.data.content).to.equal(TEXT_MSG.content);
|
expect(msg.data.content).to.equal(TEXT_MSG.content);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ describe('寻宝创建队伍', function() {
|
|||||||
|
|
||||||
it('两个玩家匹配到结算', function(done) {
|
it('两个玩家匹配到结算', function(done) {
|
||||||
pinusClient.on('onTeammateAct', (msg) => {
|
pinusClient.on('onTeammateAct', (msg) => {
|
||||||
console.log('onTeammateAct: ', msg);
|
checkSuccessResponse(msg);
|
||||||
});
|
});
|
||||||
pinusClient.on('onComBtlStart', (msg) => {
|
pinusClient.on('onComBtlStart', (msg) => {
|
||||||
console.log('onComBtlStart: ', msg);
|
checkSuccessResponse(msg);
|
||||||
});
|
});
|
||||||
pinusClient.on('onTeamJoin', (msg) => {
|
pinusClient.on('onTeamJoin', (msg) => {
|
||||||
console.log('onTeamJoin: ', msg);
|
checkSuccessResponse(msg);
|
||||||
});
|
});
|
||||||
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
@@ -90,7 +90,7 @@ describe('寻宝创建队伍', function() {
|
|||||||
expect(roleSt).to.have.all.keys('roleId', 'roleName', 'isCap', 'isFrd', 'headHid', 'sHid', 'topLineupCe', 'lv', 'isRobot', 'heroes', 'killed', 'totalDmg', 'frdRatio');
|
expect(roleSt).to.have.all.keys('roleId', 'roleName', 'isCap', 'isFrd', 'headHid', 'sHid', 'topLineupCe', 'lv', 'isRobot', 'heroes', 'killed', 'totalDmg', 'frdRatio');
|
||||||
});
|
});
|
||||||
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
|
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
|
||||||
console.log('searchRes:', searchRes);
|
// console.log('searchRes:', searchRes);
|
||||||
checkSuccessResponse(searchRes, false);
|
checkSuccessResponse(searchRes, false);
|
||||||
if (searchRes.data && searchRes.data.teamCode) {
|
if (searchRes.data && searchRes.data.teamCode) {
|
||||||
expect(searchRes.data).to.be.an('object');
|
expect(searchRes.data).to.be.an('object');
|
||||||
@@ -115,7 +115,7 @@ describe('寻宝创建队伍', function() {
|
|||||||
|
|
||||||
it('先搜索再创建队伍的匹配情况', function(done) {
|
it('先搜索再创建队伍的匹配情况', function(done) {
|
||||||
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
|
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
|
||||||
console.log('searchRes:', searchRes);
|
// console.log('searchRes:', searchRes);
|
||||||
checkSuccessResponse(searchRes, false);
|
checkSuccessResponse(searchRes, false);
|
||||||
if (!searchRes.data) {
|
if (!searchRes.data) {
|
||||||
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { resResult } from '../app/pubUtils/util';
|
import { resResult } from '../app/pubUtils/util';
|
||||||
describe('测试 ts', function() {
|
describe('测试工具方法', function() {
|
||||||
it('用例1', function() {
|
it('测试 resResult', function() {
|
||||||
const result = resResult({code: 0, simStr: 'hello'});
|
const result = resResult({code: 0, simStr: 'hello'});
|
||||||
console.log('ltc result: ', result);
|
// console.log('ltc result: ', result);
|
||||||
expect(result).to.be.an('object');
|
expect(result).to.be.an('object');
|
||||||
expect(result.code).equal(0);
|
expect(result.code).equal(0);
|
||||||
expect(result.msg).equal('hello');
|
expect(result.msg).equal('hello');
|
||||||
|
|||||||
Reference in New Issue
Block a user