测试:抽象网络请求返回值成功检查;添加寻宝匹配初步测试
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
import { expect } from 'chai';
|
||||
import { checkSuccessResponse } from './CheckPatten';
|
||||
|
||||
export class Client {
|
||||
_client;
|
||||
_roleInfo;
|
||||
private _client;
|
||||
private _roleInfo;
|
||||
constructor(tel: string = '13911134885') {
|
||||
this._client = new PinusWSClient();
|
||||
|
||||
@@ -16,16 +17,14 @@ export class Client {
|
||||
// 连接成功执行函数
|
||||
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');
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.token).to.be.an('string');
|
||||
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (ret) => {
|
||||
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (enterRes) => {
|
||||
// 消息回调
|
||||
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;
|
||||
checkSuccessResponse(enterRes);
|
||||
expect(enterRes.data.role).to.be.an('object');
|
||||
this._roleInfo = enterRes.data.role;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user