测试:抽象登录逻辑,并使用到寻宝测试中
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
import { expect } from 'chai';
|
||||
|
||||
export class Client {
|
||||
_client;
|
||||
_roleInfo;
|
||||
constructor(tel: string = '13911134885') {
|
||||
this._client = new PinusWSClient();
|
||||
|
||||
let host = '127.0.0.1';
|
||||
let port = '3050';
|
||||
this._client.init({
|
||||
host: host,
|
||||
port: port
|
||||
}, (data) => {
|
||||
// 连接成功执行函数
|
||||
console.log('gate连接成功');
|
||||
this._client.request('connector.entryHandler.debugQueryToken', {tel, magicWord: 'zyz666server518'}, (res) => {
|
||||
expect(res).to.be.an('object');
|
||||
expect(res.data).to.be.an('object');
|
||||
expect(res.data.token).to.be.an('string');
|
||||
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (ret) => {
|
||||
// 消息回调
|
||||
console.log('connector返回');
|
||||
expect(ret).to.be.an('object');
|
||||
expect(ret.data).to.be.an('object');
|
||||
expect(ret.data.role).to.be.an('object');
|
||||
this._roleInfo = ret.data.role;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get roleInfo() {
|
||||
return this._roleInfo;
|
||||
}
|
||||
|
||||
get client() {
|
||||
return this._client;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user