测试:其它几个测试用例也使用新的初始化
This commit is contained in:
@@ -1,48 +1,9 @@
|
|||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { PinusWSClient, PinusWSClientEvent } from 'pinus-robot-plugin';
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
import { Client } from './Client';
|
||||||
describe('test zyz login', function() {
|
describe('test zyz login', function() {
|
||||||
// it('异步请求应该返回一个对象', function(done){
|
let pinusClient: PinusWSClient;
|
||||||
// request
|
|
||||||
// .get('https://api.github.com')
|
|
||||||
// .end(function(err, res){
|
|
||||||
// expect(res).to.be.an('object');
|
|
||||||
// done();
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
var pinusClient;
|
|
||||||
const loginParms = {serverId: 1};
|
|
||||||
|
|
||||||
beforeEach(function(done) {
|
|
||||||
pinusClient = new PinusWSClient();
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_IO_ERROR, (event) => {
|
|
||||||
// 错误处理
|
|
||||||
// console.error('error', event);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_CLOSE, function(event) {
|
|
||||||
// 关闭处理
|
|
||||||
// console.error('close', event);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_HEART_BEAT_TIMEOUT, function(event) {
|
|
||||||
// 心跳timeout
|
|
||||||
// console.error('heart beat timeout', event);
|
|
||||||
});
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_KICK, function(event) {
|
|
||||||
// 踢出
|
|
||||||
// console.error('kick', event);
|
|
||||||
});
|
|
||||||
let host = '127.0.0.1';
|
|
||||||
let port = '3050';
|
|
||||||
pinusClient.init({
|
|
||||||
host: host,
|
|
||||||
port: port
|
|
||||||
}, (data) => {
|
|
||||||
// 连接成功执行函数
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function(done) {
|
afterEach(function(done) {
|
||||||
pinusClient.disconnect();
|
pinusClient.disconnect();
|
||||||
@@ -50,17 +11,12 @@ describe('test zyz login', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('登录测试', function(done) {
|
it('登录测试', function(done) {
|
||||||
expect(1).equal(1);
|
const c = new Client();
|
||||||
pinusClient.request('connector.entryHandler.debugQueryToken', {tel: '13911134885', magicWord: 'zyz666server518'}, (res) => {
|
setTimeout(() => {
|
||||||
expect(res).to.be.an('object');
|
expect(c.client).to.be.an('object');
|
||||||
expect(res.data).to.be.an('object');
|
expect(c.roleInfo).to.be.an('object');
|
||||||
expect(res.data.token).to.be.an('string');
|
pinusClient = c.client;
|
||||||
pinusClient.request('connector.entryHandler.enter', {...loginParms, ...res.data}, (ret) => {
|
done();
|
||||||
expect(ret).to.be.an('object');
|
}, 500);
|
||||||
expect(ret.code).equal(0);
|
|
||||||
// 消息回调
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Client } from './Client';
|
import { Client } from './Client';
|
||||||
import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst';
|
import { COM_BTL_QUALITY } from './../app/consts/constModules/itemConst';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { PinusWSClient, PinusWSClientEvent } from 'pinus-robot-plugin';
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
describe('寻宝创建队伍', function() {
|
describe('寻宝创建队伍', function() {
|
||||||
var pinusClient: PinusWSClient;
|
var pinusClient: PinusWSClient;
|
||||||
|
|||||||
@@ -1,63 +1,20 @@
|
|||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { PinusWSClient, PinusWSClientEvent } from 'pinus-robot-plugin';
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
import { Client } from './Client';
|
||||||
describe('军团测试', function() {
|
describe('军团测试', function() {
|
||||||
// it('异步请求应该返回一个对象', function(done){
|
let pinusClient: PinusWSClient;
|
||||||
// request
|
|
||||||
// .get('https://api.github.com')
|
|
||||||
// .end(function(err, res){
|
|
||||||
// expect(res).to.be.an('object');
|
|
||||||
// done();
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
var pinusClient;
|
|
||||||
var roleInfo;
|
|
||||||
let guildList;
|
let guildList;
|
||||||
const loginParms = {serverId: 1};
|
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
pinusClient = new PinusWSClient();
|
const c = new Client();
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_IO_ERROR, (event) => {
|
const timer = setInterval(() => {
|
||||||
// 错误处理
|
if (c.client) {
|
||||||
// console.error('error', event);
|
pinusClient = c.client;
|
||||||
|
clearInterval(timer);
|
||||||
done();
|
done();
|
||||||
});
|
}
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_CLOSE, function(event) {
|
}, 500);
|
||||||
// 关闭处理
|
|
||||||
// console.error('close', event);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_HEART_BEAT_TIMEOUT, function(event) {
|
|
||||||
// 心跳timeout
|
|
||||||
// console.error('heart beat timeout', event);
|
|
||||||
});
|
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_KICK, function(event) {
|
|
||||||
// 踢出
|
|
||||||
// console.error('kick', event);
|
|
||||||
});
|
|
||||||
let host = '127.0.0.1';
|
|
||||||
let port = '3050';
|
|
||||||
pinusClient.init({
|
|
||||||
host: host,
|
|
||||||
port: port
|
|
||||||
}, (data) => {
|
|
||||||
// 连接成功执行函数
|
|
||||||
console.log('gate连接成功');
|
|
||||||
// console.log('gate连接成功', data);
|
|
||||||
// done();
|
|
||||||
pinusClient.request('connector.entryHandler.debugQueryToken', {tel: '13911134885', magicWord: 'zyz666server518'}, (res) => {
|
|
||||||
expect(res).to.be.an('object');
|
|
||||||
expect(res.data).to.be.an('object');
|
|
||||||
expect(res.data.token).to.be.an('string');
|
|
||||||
pinusClient.request('connector.entryHandler.enter', {...loginParms, ...res.data}, (ret) => {
|
|
||||||
// 消息回调
|
|
||||||
console.log('connector返回');
|
|
||||||
// console.log('connector返回', JSON.stringify(ret));
|
|
||||||
roleInfo = ret.role;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function(done) {
|
afterEach(function(done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user