测试:军团练兵场测试
This commit is contained in:
@@ -2,7 +2,9 @@ import 'mocha';
|
||||
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
import { expect } from 'chai';
|
||||
import { Client } from './Client';
|
||||
import { checkDisplayItems, checkSuccessResponse } from './CheckPatten';
|
||||
import { checkDisplayItems, checkSuccessResponse, checkTimeStamp } from './CheckPatten';
|
||||
import { getRandSingleEelm } from '../app/pubUtils/util';
|
||||
import { DEBUG_MAGIC_WORD } from '../app/consts';
|
||||
describe('军团测试', function() {
|
||||
let pinusClient: PinusWSClient;
|
||||
let guildList;
|
||||
@@ -259,23 +261,130 @@ describe('军团测试', function() {
|
||||
}
|
||||
|
||||
it('获得捐献所数据', function (done) {
|
||||
pinusClient.request('guild.donateHandler.getDonation', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.receiveBoxs).to.be.an('array');
|
||||
res.data.receiveBoxs.forEach(box => {
|
||||
expect(box).to.be.a('number');
|
||||
});
|
||||
expect(res.data.donateFund).to.be.a('number');
|
||||
expect(res.data.reports).to.be.an('array');
|
||||
res.data.reports.forEach(report => {
|
||||
expect(report.id).to.be.a('number');
|
||||
expect(report.roleName).to.be.a('string');
|
||||
checkTimeStamp(report.time, 10, true);
|
||||
});
|
||||
expect(res.data.donateCnt).to.be.a('number');
|
||||
expect(res.data.donationLv).to.be.a('number');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('捐献', function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('捐献', function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
let trainInstances;
|
||||
let trainId;
|
||||
it('获取练兵场信息', function (done) {
|
||||
done();
|
||||
pinusClient.request('guild.guildTrainHandler.getTrainInstance', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkGuildTrain(res.data.guildTrain);
|
||||
checkTrainCount(res.data)
|
||||
expect(res.data.buyTrainCount).to.be.a('number');
|
||||
expect(res.data.trainLv).to.be.a('number');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
function checkTrainCount(data) {
|
||||
expect(data.trainCount).to.be.a('number');
|
||||
expect(data.trainRewards).to.be.an('array');
|
||||
data.trainRewards.forEach(reward => {
|
||||
expect(reward).to.be.a('number');
|
||||
})
|
||||
}
|
||||
function checkGuildTrain(guildTrain) {
|
||||
expect(guildTrain.trainId).to.be.a('number');
|
||||
trainId = guildTrain.trainId;
|
||||
expect(guildTrain.isComplete).to.be.a('boolean');
|
||||
checkTrainInstances(guildTrain.trainInstances);
|
||||
if(guildTrain.reports) checkTrainReports(guildTrain.reports)
|
||||
if(guildTrain.trainBoxs) checkTrainBoxs(guildTrain.trainBoxs);
|
||||
}
|
||||
|
||||
function checkTrainInstances(data) {
|
||||
expect(data).to.be.an('array');
|
||||
data.forEach(trainInstance => {
|
||||
expect(trainInstance.hid).to.be.a('number');
|
||||
expect(trainInstance.progress).to.be.a('number');
|
||||
expect(trainInstance.endTime).to.be.a('number');
|
||||
expect(trainInstance.isComplete).to.be.a('boolean');
|
||||
});
|
||||
trainInstances = data;
|
||||
}
|
||||
|
||||
function checkTrainReports(reports) {
|
||||
expect(reports).to.be.an('array');
|
||||
reports.forEach(report => {
|
||||
expect(report.roleId).to.be.a('string');
|
||||
expect(report.trainId).to.be.a('number');
|
||||
expect(report.hid).to.be.a('number');
|
||||
expect(report.score).to.be.a('number');
|
||||
expect(report.time).to.be.a('number');
|
||||
expect(report.isSuccessed).to.be.a('boolean');
|
||||
expect(report.type).to.be.a('number');
|
||||
});
|
||||
}
|
||||
|
||||
function checkTrainBoxs(boxs) {
|
||||
expect(boxs).to.be.an('array');
|
||||
boxs.forEach(box => {
|
||||
expect(box.hid).to.be.a('number');
|
||||
expect(box.recordBoxs).to.be.an('array');
|
||||
box.recordBoxs.forEach(obj => {
|
||||
expect(obj.roleId).to.be.a('string');
|
||||
expect(obj.good).to.be.an('object');
|
||||
expect(obj.good.id).to.be.a('number');
|
||||
expect(obj.good.count).to.be.a('number');
|
||||
expect(obj.good.index).to.be.a('number');
|
||||
})
|
||||
|
||||
expect(box.endTime).to.be.a('number');
|
||||
expect(box.trainId).to.be.a('number');
|
||||
expect(box.isComplete).to.be.a('boolean');
|
||||
});
|
||||
}
|
||||
it('进入练兵战场', function (done) {
|
||||
done();
|
||||
let trainInstance: any = getRandSingleEelm(trainInstances.filter(cur => !cur.isComplete));
|
||||
if(!trainInstances) {
|
||||
pinusClient.request('guild.guildTrainHandler.debugResetTrainInstance', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
trainBattleStart()
|
||||
});
|
||||
} else {
|
||||
trainBattleStart()
|
||||
}
|
||||
function trainBattleStart() {
|
||||
pinusClient.request('guild.guildTrainHandler.debugAddTrainCount', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
pinusClient.request('guild.guildTrainHandler.trainBattleStart', { hid: trainInstance.hid, difficulty: 1, trainId, battleId: 8501 }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.battleCode).to.be.a('string');
|
||||
battleCode = res.data.battleCode;
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('战斗结算', function (done) {
|
||||
done();
|
||||
pinusClient.request('guild.guildTrainHandler.trainBattleEnd', { battleCode, isSuccess: true }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkDisplayItems(res.data.battleGoods);
|
||||
checkGuildTrain(res.data.guildTrain);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('获得练兵场战报', function (done) {
|
||||
@@ -286,11 +395,11 @@ describe('军团测试', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
it('点亮研发', function (done) {
|
||||
it.skip('点亮研发', function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('炼器', function (done) {
|
||||
it.skip('炼器', function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -298,7 +407,7 @@ describe('军团测试', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
it('许愿', function (done) {
|
||||
it.skip('许愿', function (done) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user