163 lines
7.7 KiB
TypeScript
163 lines
7.7 KiB
TypeScript
import 'mocha';
|
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
|
import { expect } from 'chai';
|
|
import { Client } from './Client';
|
|
import { checkSuccessResponse } from './CheckPatten';
|
|
describe('军团测试', function() {
|
|
let pinusClient: PinusWSClient;
|
|
let guildList;
|
|
|
|
beforeEach(function(done) {
|
|
const c = new Client();
|
|
const timer = setInterval(() => {
|
|
if (c.client) {
|
|
pinusClient = c.client;
|
|
clearInterval(timer);
|
|
done();
|
|
}
|
|
}, 500);
|
|
});
|
|
|
|
afterEach(function(done) {
|
|
pinusClient.disconnect();
|
|
done();
|
|
});
|
|
|
|
it('获取军团列表', function(done) {
|
|
pinusClient.request('battle.guildHandler.getGuildList', {page:1, showPeopleMax: true, name: ""} , (res) => {
|
|
// console.log(JSON.stringify(res))
|
|
// 消息回调
|
|
checkSuccessResponse(res);
|
|
expect(res.data).to.have.deep.property('list').that.is.an('array');
|
|
expect(res.data).to.have.deep.property('quitTime').that.is.an('number');
|
|
guildList = res.data.list;
|
|
res.data.list.forEach(list => {
|
|
expect(list).to.have.deep.property('code').that.is.a('string');
|
|
expect(list).to.have.deep.property('name').that.is.a('string');
|
|
expect(list).to.have.deep.property('icon').that.is.a('number');
|
|
expect(list).to.have.deep.property('lv').that.is.a('number');
|
|
expect(list).to.have.deep.property('memberCnt').that.is.a('number');
|
|
expect(list).to.have.deep.property('leader').that.is.a('string');
|
|
expect(list).to.have.deep.property('ceLimit').that.is.a('number');
|
|
expect(list).to.have.deep.property('hasApply').that.is.a('boolean');
|
|
});
|
|
done();
|
|
});
|
|
});
|
|
|
|
|
|
it('获取个人军团', function (done) {
|
|
pinusClient.request('battle.guildHandler.getMyGuildInfo', { }, (res) => {
|
|
// 消息回调
|
|
checkSuccessResponse(res);
|
|
expect(res.data).to.have.deep.property('hasGuild').that.is.an('boolean');
|
|
if(res.data.hasGuild) {
|
|
expect(res.data).to.have.deep.property('code').that.is.an('string');
|
|
expect(res.data).to.have.deep.property('name').that.is.an('string');
|
|
expect(res.data).to.have.deep.property('icon').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('notice').that.is.an('string');
|
|
expect(res.data).to.have.deep.property('introduce').that.is.an('string');
|
|
expect(res.data).to.have.deep.property('rank').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('lv').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('fund').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('memberCnt').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('managerCnt').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('activeDaily').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('activeWeekly').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('ceLimit').that.is.an('number');
|
|
expect(res.data).to.have.deep.property('isAuto').that.is.an('boolean');
|
|
|
|
expect(res.data).to.have.deep.property('leader').that.is.an('object');
|
|
expect(res.data.leader).to.have.deep.property('roleName').that.is.an('string');
|
|
expect(res.data.leader).to.have.deep.property('frame').that.is.an('number');
|
|
expect(res.data.leader).to.have.deep.property('spine').that.is.an('number');
|
|
expect(res.data.leader).to.have.deep.property('head').that.is.an('number');
|
|
expect(res.data.leader).to.have.deep.property('lv').that.is.an('number');
|
|
expect(res.data.leader).to.have.deep.property('ce').that.is.an('number');
|
|
// expect(res.data.leader).to.have.deep.property('loginTime').that.is.an('number');
|
|
|
|
expect(res.data).to.have.deep.property('myInfo').that.is.an('object');
|
|
// expect(res.data.myInfo).to.have.deep.property('honourWeekly').that.is.an('number');
|
|
expect(res.data.myInfo).to.have.deep.property('job').that.is.an('number');
|
|
expect(res.data.myInfo).to.have.deep.property('auth').that.is.an('number');
|
|
|
|
expect(res.data).to.have.deep.property('structure').that.is.an('array');
|
|
res.data.structure.forEach(list => {
|
|
expect(list).to.have.deep.property('id').that.is.a('number');
|
|
expect(list).to.have.deep.property('lv').that.is.a('number');
|
|
});
|
|
}
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('获取申请列表', function (done) {
|
|
pinusClient.request('battle.guildHandler.getApplyList', { }, (res) => {
|
|
// 消息回调
|
|
checkSuccessResponse(res);
|
|
expect(res.data).to.have.deep.property('list').that.is.an('array');
|
|
res.data.list.forEach(list => {
|
|
expect(list).to.have.deep.property('applyCode').that.is.a('string');
|
|
expect(list).to.have.deep.property('roleId').that.is.a('string');
|
|
expect(list).to.have.deep.property('roleName').that.is.a('string');
|
|
expect(list).to.have.deep.property('ce').that.is.a('number');
|
|
expect(list).to.have.deep.property('head').that.is.a('number');
|
|
expect(list).to.have.deep.property('spine').that.is.a('number');
|
|
expect(list).to.have.deep.property('frame').that.is.a('number');
|
|
expect(list).to.have.deep.property('lv').that.is.a('number');
|
|
expect(list).to.have.deep.property('title').that.is.a('number');
|
|
expect(list).to.have.deep.property('loginTime').that.is.a('number');
|
|
});
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('团长查看可邀请列表', function (done) {
|
|
pinusClient.request('battle.guildHandler.getInviteMemberList', { }, (res) => {
|
|
// 消息回调
|
|
checkSuccessResponse(res);
|
|
expect(res.data).to.have.deep.property('list').that.is.an('array');
|
|
res.data.list.forEach(list => {
|
|
expect(list).to.have.deep.property('roleId').that.is.a('string');
|
|
expect(list).to.have.deep.property('roleName').that.is.a('string');
|
|
expect(list).to.have.deep.property('ce').that.is.a('number');
|
|
expect(list).to.have.deep.property('head').that.is.a('number');
|
|
expect(list).to.have.deep.property('spine').that.is.a('number');
|
|
expect(list).to.have.deep.property('frame').that.is.a('number');
|
|
expect(list).to.have.deep.property('lv').that.is.a('number');
|
|
expect(list).to.have.deep.property('title').that.is.a('number');
|
|
// expect(list).to.have.deep.property('loginTime').that.is.a('number');
|
|
});
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('查看军团成员列表', function (done) {
|
|
let index = Math.floor(Math.random() * guildList.length);
|
|
if(guildList[index]) {
|
|
let code = guildList[index].code;
|
|
|
|
pinusClient.request('battle.guildHandler.getGuildMember', { code }, (res) => {
|
|
// 消息回调
|
|
checkSuccessResponse(res);
|
|
expect(res.data).to.have.deep.property('list').that.is.an('array');
|
|
res.data.list.forEach(list => {
|
|
expect(list).to.have.deep.property('roleId').that.is.a('string');
|
|
expect(list).to.have.deep.property('roleName').that.is.a('string');
|
|
expect(list).to.have.deep.property('ce').that.is.a('number');
|
|
expect(list).to.have.deep.property('head').that.is.a('number');
|
|
expect(list).to.have.deep.property('spine').that.is.a('number');
|
|
expect(list).to.have.deep.property('frame').that.is.a('number');
|
|
expect(list).to.have.deep.property('lv').that.is.a('number');
|
|
expect(list).to.have.deep.property('title').that.is.a('number');
|
|
// expect(list).to.have.deep.property('loginTime').that.is.a('number');
|
|
expect(list).to.have.deep.property('job').that.is.a('number');
|
|
// expect(list).to.have.deep.property('auth').that.is.a('number');
|
|
// expect(list).to.have.deep.property('honourWeekly').that.is.a('number');
|
|
});
|
|
done();
|
|
});
|
|
}
|
|
});
|
|
});
|