测试:删掉部分注释,修改用例名

This commit is contained in:
liangtongchuan
2021-03-05 10:51:19 +08:00
parent ca2d597947
commit cf2ee12445
6 changed files with 27 additions and 22 deletions

View File

@@ -15,13 +15,13 @@ export class Client {
port: port
}, (data) => {
// 连接成功执行函数
console.log('gate连接成功');
// console.log('gate连接成功');
this._client.request('connector.entryHandler.debugQueryToken', {tel, magicWord: 'zyz666server518'}, (res) => {
checkSuccessResponse(res);
expect(res.data.token).to.be.an('string');
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (enterRes) => {
// 消息回调
console.log('connector返回');
// console.log('connector返回');
checkSuccessResponse(enterRes);
expect(enterRes.data.role).to.be.an('object');
this._roleInfo = enterRes.data.role;

View File

@@ -60,7 +60,9 @@ class PinusWSClient {
this.handlers[Package.TYPE_KICK] = this.onKick;
}
init(params, cb) {
if (PinusWSClient.DEBUG) {
console.log('init', params);
}
this.initCallback = cb;
let host = params.host;
let port = params.port;
@@ -74,7 +76,9 @@ class PinusWSClient {
this.initWebSocket(host, port, cb);
}
initWebSocket(host, port, cb) {
if (PinusWSClient.DEBUG) {
console.log('[Pinus] connect to:', host, port);
}
let url = 'ws://' + host;
if (port) {
url += ':' + port;
@@ -135,11 +139,15 @@ class PinusWSClient {
this.send(byte);
}
onConnect() {
if (PinusWSClient.DEBUG) {
console.log('[Pinus] connect success');
}
this.send(this._package.encode(Package.TYPE_HANDSHAKE, Protocol.strencode(JSON.stringify(this.handshakeBuffer))));
}
onClose(e) {
if (PinusWSClient.DEBUG) {
console.error('[Pinus] connect close');
}
// this.emit(Pinus.EVENT_CLOSE,e);
}
onIOError(e) {
@@ -260,7 +268,9 @@ class PinusWSClient {
this._disconnect();
}
_disconnect() {
if (PinusWSClient.DEBUG) {
console.warn('[Pinus] client disconnect ...');
}
if (this.socket)
this.socket.close();
this.socket = null;

View File

@@ -2,7 +2,7 @@ import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { Client } from './Client';
describe('test zyz login', function() {
describe('测试赵云传登录', function() {
let pinusClient: PinusWSClient;
afterEach(function(done) {

View File

@@ -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 { indexOf } from 'underscore';
import { COM_TEAM_STATUS, DEFAULT_HEROES } from './../../shared/consts/consts';
import { Client } from './Client';
import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst';
import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { checkDisplayItems, checkSuccessResponse } from './CheckPatten';
import { checkSuccessResponse } from './CheckPatten';
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
@@ -46,7 +42,6 @@ describe('聊天测试', function() {
it('两个玩家互相发送', function(done) {
pinusClientT.on(ON_MSG_ROUTE, (msg) => {
console.log(ON_MSG_ROUTE , msg);
checkSuccessResponse(msg);
expect(msg.data.content).to.equal(TEXT_MSG.content);
});

View File

@@ -74,13 +74,13 @@ describe('寻宝创建队伍', function() {
it('两个玩家匹配到结算', function(done) {
pinusClient.on('onTeammateAct', (msg) => {
console.log('onTeammateAct: ', msg);
checkSuccessResponse(msg);
});
pinusClient.on('onComBtlStart', (msg) => {
console.log('onComBtlStart: ', msg);
checkSuccessResponse(msg);
});
pinusClient.on('onTeamJoin', (msg) => {
console.log('onTeamJoin: ', msg);
checkSuccessResponse(msg);
});
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (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');
});
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
console.log('searchRes:', searchRes);
// console.log('searchRes:', searchRes);
checkSuccessResponse(searchRes, false);
if (searchRes.data && searchRes.data.teamCode) {
expect(searchRes.data).to.be.an('object');
@@ -115,7 +115,7 @@ describe('寻宝创建队伍', function() {
it('先搜索再创建队伍的匹配情况', function(done) {
pinusClientT.request('battle.comBattleHandler.searchTeam', searchTeamParms, (searchRes) => {
console.log('searchRes:', searchRes);
// console.log('searchRes:', searchRes);
checkSuccessResponse(searchRes, false);
if (!searchRes.data) {
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {

View File

@@ -1,10 +1,10 @@
import 'mocha';
import { expect } from 'chai';
import { resResult } from '../app/pubUtils/util';
describe('测试 ts', function() {
it('用例1', function() {
describe('测试工具方法', function() {
it('测试 resResult', function() {
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.code).equal(0);
expect(result.msg).equal('hello');