测试:战斗测试
This commit is contained in:
@@ -7,6 +7,7 @@ import { getDailyNum, getDailyBattleList, getDailyBuyCountCost } from '../../../
|
|||||||
import { handleCost } from '../../../services/rewardService';
|
import { handleCost } from '../../../services/rewardService';
|
||||||
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
||||||
import { gameData } from '../../../pubUtils/data';
|
import { gameData } from '../../../pubUtils/data';
|
||||||
|
import { DEBUG_MAGIC_WORD } from '../../../consts';
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new DailyBattleHandler(app);
|
return new DailyBattleHandler(app);
|
||||||
@@ -60,4 +61,14 @@ export class DailyBattleHandler {
|
|||||||
let checkDailyResult = await getDailyNum(newDailyRecord, timesPerDay, timesCanBuy);
|
let checkDailyResult = await getDailyNum(newDailyRecord, timesPerDay, timesCanBuy);
|
||||||
return resResult(STATUS.SUCCESS, { type, ...checkDailyResult, buyCost});
|
return resResult(STATUS.SUCCESS, { type, ...checkDailyResult, buyCost});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async debugResetNum(msg: { magicWord: string, type: number }, session: BackendSession) {
|
||||||
|
const { magicWord, type } = msg;
|
||||||
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
|
}
|
||||||
|
let roleId = session.get('roleId');
|
||||||
|
await DailyRecordModel.increseBuyCount(roleId, type, 1);
|
||||||
|
return resResult(STATUS.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import { getDungeonData, getDungeonBuyCountCost } from '../../../services/dungeo
|
|||||||
import * as dicParam from '../../../pubUtils/dicParam';
|
import * as dicParam from '../../../pubUtils/dicParam';
|
||||||
import { DungeonFirstModel } from '../../../db/DungeonFirst';
|
import { DungeonFirstModel } from '../../../db/DungeonFirst';
|
||||||
import { DungeonResultParam } from '../../../domain/battleField/dungeon';
|
import { DungeonResultParam } from '../../../domain/battleField/dungeon';
|
||||||
|
import { DEBUG_MAGIC_WORD } from '../../../consts';
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new DungeonBattleHandler(app);
|
return new DungeonBattleHandler(app);
|
||||||
@@ -77,4 +78,14 @@ export class DungeonBattleHandler {
|
|||||||
});
|
});
|
||||||
return resResult(STATUS.SUCCESS, { infos: result });
|
return resResult(STATUS.SUCCESS, { infos: result });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async debugResetRefTime(msg: { magicWord: string }, session: BackendSession) {
|
||||||
|
const { magicWord } = msg;
|
||||||
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
|
}
|
||||||
|
let roleId = session.get('roleId');
|
||||||
|
await RoleModel.updateRoleInfo(roleId, { dungeonRefTime: new Date(Date.now() - 86400000) });
|
||||||
|
return resResult(STATUS.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Application, BackendSession, HandlerService, } from 'pinus';
|
import { Application, BackendSession, HandlerService, } from 'pinus';
|
||||||
import { EventRecordModel } from '../../../db/EventRecord';
|
import { EventRecordModel } from '../../../db/EventRecord';
|
||||||
import { RoleModel } from '../../../db/Role';
|
import { RoleModel } from '../../../db/Role';
|
||||||
import { EVENT_STATUS, EVENT_RECORD_STATUS, EVENT_ANSWER_STATUS, TASK_TYPE } from '../../../consts';
|
import { EVENT_STATUS, EVENT_RECORD_STATUS, EVENT_ANSWER_STATUS, TASK_TYPE, DEBUG_MAGIC_WORD } from '../../../consts';
|
||||||
import { checkEventStatus, getEventSuccessStatus, getEvent, checkQuiz, startEvent } from '../../../services/eventSercive';
|
import { checkEventStatus, getEventSuccessStatus, getEvent, checkQuiz, startEvent, refreshEvent, getEventTime } from '../../../services/eventSercive';
|
||||||
import { addItems } from '../../../services/rewardService';
|
import { addItems } from '../../../services/rewardService';
|
||||||
import { STATUS } from '../../../consts/statusCode';
|
import { STATUS } from '../../../consts/statusCode';
|
||||||
import { resResult } from '../../../pubUtils/util';
|
import { resResult } from '../../../pubUtils/util';
|
||||||
@@ -137,4 +137,17 @@ export class EventBattleHandler {
|
|||||||
goods
|
goods
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async debugRefEvent(msg: { magicWord: string }, session: BackendSession) {
|
||||||
|
const { magicWord } = msg;
|
||||||
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
|
}
|
||||||
|
let roleId = session.get('roleId');
|
||||||
|
let roleName = session.get('roleName');
|
||||||
|
let now = new Date();
|
||||||
|
let curTime = getEventTime(now); // 这次的时间节点 0-12:前一天的18 12-18:12 18-24: 18
|
||||||
|
let result = await refreshEvent(3, roleId, roleName, curTime, [])
|
||||||
|
return resResult(STATUS.SUCCESS, { list: result });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
|
|||||||
import { RoleModel } from '../../../db/Role';
|
import { RoleModel } from '../../../db/Role';
|
||||||
import { calculateSumCE, genCode } from '../../../pubUtils/util';
|
import { calculateSumCE, genCode } from '../../../pubUtils/util';
|
||||||
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies, getExpeditionStatus } from '../../../services/expeditionService';
|
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies, getExpeditionStatus } from '../../../services/expeditionService';
|
||||||
import { EXPEDITION_WAR_RECORD_STATUS, KING_EXP_RATIO_TYPE, LINEUP_NUM, TASK_TYPE } from '../../../consts';
|
import { DEBUG_MAGIC_WORD, EXPEDITION_WAR_RECORD_STATUS, KING_EXP_RATIO_TYPE, LINEUP_NUM, TASK_TYPE } from '../../../consts';
|
||||||
import { WarReward } from '../../../services/warRewardService';
|
import { WarReward } from '../../../services/warRewardService';
|
||||||
import { addItems } from '../../../services/rewardService';
|
import { addItems } from '../../../services/rewardService';
|
||||||
import { getAp, setAp } from '../../../services/actionPointService';
|
import { getAp, setAp } from '../../../services/actionPointService';
|
||||||
@@ -313,4 +313,13 @@ export class ExpeditionBattleHandler {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async debugResetResetNum(msg: { magicWord: string }, session: BackendSession) {
|
||||||
|
const { magicWord } = msg;
|
||||||
|
if (magicWord !== DEBUG_MAGIC_WORD) {
|
||||||
|
return resResult(STATUS.TOKEN_ERR);
|
||||||
|
}
|
||||||
|
let roleId = session.get('roleId');
|
||||||
|
await RoleModel.updateRoleInfo(roleId, { expeditionResetCnt: 0 });
|
||||||
|
return resResult(STATUS.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function checkDisplayItems(items) {
|
|||||||
export function checkBattleGoods(items) {
|
export function checkBattleGoods(items) {
|
||||||
expect(items).to.be.an('array');
|
expect(items).to.be.an('array');
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
expect(item.dropType).to.be.a('number');
|
if(item.dropType) expect(item.dropType).to.be.a('number');
|
||||||
if(item.seqId) expect(item.seqId).to.be.a('number');
|
if(item.seqId) expect(item.seqId).to.be.a('number');
|
||||||
expect(item.id).to.be.a('number');
|
expect(item.id).to.be.a('number');
|
||||||
expect(item.count).to.be.a('number');
|
expect(item.count).to.be.a('number');
|
||||||
@@ -106,7 +106,7 @@ export function checkTimeStamp(time, len, canBeZero) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkWarJson(heroes) {
|
export function checkWarJson(heroes, cb?) {
|
||||||
expect(heroes).to.be.an('array');
|
expect(heroes).to.be.an('array');
|
||||||
heroes.forEach(hero => {
|
heroes.forEach(hero => {
|
||||||
expect(hero.actorId).to.be.a('number');
|
expect(hero.actorId).to.be.a('number');
|
||||||
@@ -127,5 +127,6 @@ export function checkWarJson(heroes) {
|
|||||||
expect(hero.skill).to.be.a('string');
|
expect(hero.skill).to.be.a('string');
|
||||||
expect(hero.seid).to.be.a('string');
|
expect(hero.seid).to.be.a('string');
|
||||||
expect(hero.spine).to.be.a('string');
|
expect(hero.spine).to.be.a('string');
|
||||||
|
if(cb) cb(hero);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import { DEBUG_MAGIC_WORD } from '../app/consts';
|
|||||||
import { getRandSingleEelm } from '../app/pubUtils/util';
|
import { getRandSingleEelm } from '../app/pubUtils/util';
|
||||||
|
|
||||||
const NORMAIL_BATTLEID = 101;
|
const NORMAIL_BATTLEID = 101;
|
||||||
|
const DUNGEON_BATTLEID = 5001;
|
||||||
|
|
||||||
describe('战斗测试', function () {
|
describe('战斗测试', function () {
|
||||||
let pinusClient: PinusWSClient;
|
let pinusClient: PinusWSClient;
|
||||||
@@ -74,107 +75,499 @@ describe('战斗测试', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
it.skip('保存R剧本', function (done) {
|
||||||
it('保存R剧本', function (done) {
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('根据战场获取R剧本', function (done) {
|
it.skip('根据战场获取R剧本', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('发送剧情弹幕', function (done) {
|
it.skip('发送剧情弹幕', function (done) {
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('获取剧情弹幕', function (done) {
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let dailyList;
|
||||||
|
let battleId;
|
||||||
it('获取每日关卡列表', function (done) {
|
it('获取每日关卡列表', function (done) {
|
||||||
done();
|
pinusClient.request('battle.dailyBattleHandler.getData', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.list).to.be.an('array');
|
||||||
|
res.data.list.forEach(data => {
|
||||||
|
expect(data.type).to.be.a('number');
|
||||||
|
expect(data.count).to.be.a('number');
|
||||||
|
expect(data.buyCount).to.be.a('number');
|
||||||
|
expect(data.wars).to.be.an('array');
|
||||||
|
data.wars.forEach(war => {
|
||||||
|
expect(war.battleId).to.be.a('number');
|
||||||
|
expect(war.cost).to.be.a('number');
|
||||||
|
expect(war.star).to.be.a('number');
|
||||||
|
expect(war.status).to.be.a('number');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
dailyList = res.data.list;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('购买每日次数', function (done) {
|
it.skip('购买每日次数', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('每日关卡开始战斗', function (done) {
|
it('每日关卡开始战斗', function (done) {
|
||||||
done();
|
let type;
|
||||||
});
|
for(let data of dailyList) {
|
||||||
|
for(let war of data.wars) {
|
||||||
it('每日关卡开始战斗', function (done) {
|
if(war.status == 1) {
|
||||||
done();
|
type = data.type;
|
||||||
|
battleId = war.battleId;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pinusClient.request('battle.dailyBattleHandler.debugResetNum', { magicWord: DEBUG_MAGIC_WORD, type }, (res) => {
|
||||||
|
checkSuccessResponse(res, false);
|
||||||
|
checkBattle(pinusClient, paramHeroes, battleId, 'daily', data => {
|
||||||
|
battleCode = data.battleCode;
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('每日关卡结束战斗', function (done) {
|
it('每日关卡结束战斗', function (done) {
|
||||||
done();
|
battleEnd(pinusClient, paramHeroes, battleId, battleCode, 'daily', data => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let event;
|
||||||
it('获取奇遇事件', function (done) {
|
it('获取奇遇事件', function (done) {
|
||||||
done();
|
pinusClient.request('battle.eventBattleHandler.getEvents', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkEvents(res.data.list, events => {
|
||||||
|
let eventOn = events.filter(cur => cur.status != 3 && cur.status != 4 );
|
||||||
|
if(eventOn.length <= 0) {
|
||||||
|
pinusClient.request('battle.eventBattleHandler.debugRefEvent', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkEvents(res.data.list, events => {
|
||||||
|
let eventOn = events.filter(cur => cur.status != 3 && cur.status != 4 );
|
||||||
|
expect(eventOn.length).not.equal(0);
|
||||||
|
event = getRandSingleEelm(eventOn);
|
||||||
|
done()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
event = getRandSingleEelm(eventOn);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkEvents(events, cb) {
|
||||||
|
expect(events).to.be.an('array');
|
||||||
|
events.forEach(event => {
|
||||||
|
expect(event.eventCode).to.be.a('string');
|
||||||
|
expect(event.battleId).to.be.a('number');
|
||||||
|
expect(event.eventId).to.be.a('number');
|
||||||
|
expect(event.quality).to.be.a('number');
|
||||||
|
if(event.question) {
|
||||||
|
expect(event.question).to.be.an('array');
|
||||||
|
event.question.forEach(question => {
|
||||||
|
expect(question.id).to.be.a('number');
|
||||||
|
expect(question.question).to.be.a('string');
|
||||||
|
expect(question.answer).to.be.an('array');
|
||||||
|
question.answer.forEach(answer => {
|
||||||
|
expect(answer).to.be.a('string');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
expect(event.point).to.be.a('number');
|
||||||
|
expect(event.status).to.be.a('number');
|
||||||
|
expect(event.type).to.be.a('number');
|
||||||
|
});
|
||||||
|
cb(events);
|
||||||
|
}
|
||||||
|
|
||||||
it('奇遇事件回答问题', function (done) {
|
it('奇遇事件回答问题', function (done) {
|
||||||
done();
|
let { eventId, eventCode, question: questions, status } = event;
|
||||||
|
if(event.type == 2 && status == 0) {
|
||||||
|
checkAnswer(0);
|
||||||
|
function checkAnswer(index) {
|
||||||
|
if(index == questions.length) {
|
||||||
|
done();
|
||||||
|
} else {
|
||||||
|
let question = questions[index];
|
||||||
|
pinusClient.request('battle.eventBattleHandler.checkAnswer', { eventId, eventCode, questionId: question.id, answer: Math.floor(Math.random() * 3) }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.eventCode).to.be.a('string');
|
||||||
|
expect(res.data.eventId).to.be.a('number');
|
||||||
|
expect(res.data.questionId).to.be.a('number');
|
||||||
|
expect(res.data.isCorrect).to.be.a('boolean');
|
||||||
|
expect(res.data.answerNo).to.be.a('number');
|
||||||
|
checkAnswer(index + 1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('奇遇关卡开始战斗', function (done) {
|
it('奇遇关卡开始战斗', function (done) {
|
||||||
done();
|
let { battleId, status } = event;
|
||||||
|
if(event.type == 3 && status == 0) {
|
||||||
|
checkBattle(pinusClient, paramHeroes, battleId, 'event', data => {
|
||||||
|
battleCode = data.battleCode;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('奇遇关卡结束战斗', function (done) {
|
it('奇遇关卡结束战斗', function (done) {
|
||||||
done();
|
let { battleId, status } = event;
|
||||||
|
if(event.type == 3 && status == 0) {
|
||||||
|
battleEnd(pinusClient, paramHeroes, battleId, battleCode, 'event', data => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('奇遇事件领取奖励', function (done) {
|
it('奇遇事件领取奖励', function (done) {
|
||||||
done();
|
let { eventId, eventCode, status } = event;
|
||||||
|
if(status == 0|| status == 1||status == 2) {
|
||||||
|
pinusClient.request('battle.eventBattleHandler.receiveEventReward', { eventId, eventCode }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.isSuccess).to.be.a('boolean');
|
||||||
|
expect(res.data.eventCode).to.equal(eventCode);
|
||||||
|
expect(res.data.eventId).to.equal(eventId);
|
||||||
|
expect(res.data.status).to.be.a('number');
|
||||||
|
checkDisplayItems(res.data.goods);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let expeditionWarRecord;
|
||||||
|
let expeditionCode;
|
||||||
it('获取远征关卡状态', function (done) {
|
it('获取远征关卡状态', function (done) {
|
||||||
done();
|
pinusClient.request('battle.expeditionBattleHandler.getStatus', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.expeditionCode).to.be.a('string');
|
||||||
|
expeditionCode = res.data.expeditionCode;
|
||||||
|
expect(res.data.curLv).to.be.a('number');
|
||||||
|
checkExpeditionWarRecord(res.data.expeditionWarRecord);
|
||||||
|
checkPointRewards(res.data.pointRewards);
|
||||||
|
expect(res.data.heroes).to.be.an('array');
|
||||||
|
res.data.heroes.forEach(hero => {
|
||||||
|
expect(hero.dataId).to.be.a('number');
|
||||||
|
expect(hero.hp).to.be.a('number');
|
||||||
|
expect(hero.ap).to.be.a('number');
|
||||||
|
});
|
||||||
|
expect(res.data.resetCnt).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('重置远征关卡', function (done) {
|
it('重置远征关卡', function (done) {
|
||||||
done();
|
pinusClient.request('battle.expeditionBattleHandler.debugResetResetNum', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
|
checkSuccessResponse(res, false);
|
||||||
|
pinusClient.request('battle.expeditionBattleHandler.resetStatus', {}, (res) => {
|
||||||
|
expect(res.data.expeditionCode).to.be.a('string');
|
||||||
|
expeditionCode = res.data.expeditionCode;
|
||||||
|
expect(res.data.curLv).to.be.a('number');
|
||||||
|
checkExpeditionWarRecord(res.data.expeditionWarRecord);
|
||||||
|
expect(res.data.heroes).to.be.an('array');
|
||||||
|
expect(res.data.resetCnt).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('远征获取敌军数据', function (done) {
|
it('远征获取敌军数据', function (done) {
|
||||||
done();
|
let { expeditionId, battleId } = expeditionWarRecord;
|
||||||
|
pinusClient.request('battle.expeditionBattleHandler.getEnemies', { expeditionCode, expeditionId }, (res) => {
|
||||||
|
checkSuccessResponse(res, false);
|
||||||
|
expect(res.data.expeditionCode).to.equal(expeditionCode);
|
||||||
|
expect(res.data.expeditionId).to.equal(expeditionId);
|
||||||
|
expect(res.data.battleId).to.equal(battleId);
|
||||||
|
expect(res.data.mapseid).to.be.a('number');
|
||||||
|
expect(res.data.battleStatus).to.equal(0);
|
||||||
|
expect(res.data.enemyFrom).to.be.a('number');
|
||||||
|
checkWarJson(res.data.enemies, hero => {
|
||||||
|
expect(hero.cur).to.be.an('object');
|
||||||
|
expect(hero.cur.hp).to.be.a('number');
|
||||||
|
expect(hero.cur.ap).to.be.a('number');
|
||||||
|
});
|
||||||
|
expect(res.data.curCe).to.be.a('number');
|
||||||
|
expect(res.data.nextCe).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('远征关卡开始战斗', function (done) {
|
it('远征关卡开始战斗', function (done) {
|
||||||
done();
|
let { expeditionId, battleId } = expeditionWarRecord;
|
||||||
|
pinusClient.request('battle.expeditionBattleHandler.checkBattle', { expeditionCode, expeditionId, battleId, heroes: paramHeroes }, (res) => {
|
||||||
|
checkSuccessResponse(res, false);
|
||||||
|
expect(res.data.expeditionCode).to.equal(expeditionCode);
|
||||||
|
expect(res.data.expeditionId).to.equal(expeditionId);
|
||||||
|
expect(res.data.battleId).to.equal(battleId);
|
||||||
|
expect(res.data.battleCode).to.be.a('string');
|
||||||
|
battleCode = res.data.battleCode;
|
||||||
|
expect(res.data.battleStatus).to.equal(0);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('远征关卡结束战斗', function (done) {
|
it('远征关卡结束战斗', function (done) {
|
||||||
|
let { expeditionId, battleId } = expeditionWarRecord;
|
||||||
|
let heroes = paramHeroes.map(hero => { return { dataId: hero, hp: 100, ap: 100 }})
|
||||||
|
pinusClient.request('battle.expeditionBattleHandler.battleEnd', {
|
||||||
|
expeditionCode, expeditionId, battleId, battleCode, heroes, enemies: [], star: 3
|
||||||
|
}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.expeditionCode).to.equal(expeditionCode);
|
||||||
|
expect(res.data.expeditionId).to.equal(expeditionId);
|
||||||
|
expect(res.data.battleId).to.equal(battleId);
|
||||||
|
expect(res.data.battleCode).to.equal(battleCode);
|
||||||
|
expect(res.data.expeditionPoint).to.be.a('number');
|
||||||
|
checkBattleGoods(res.data.battleGoods);
|
||||||
|
checkActorData(res.data.actordata);
|
||||||
|
expect(res.data.lv).to.be.a('number');
|
||||||
|
expect(res.data.exp).to.be.a('number');
|
||||||
|
expect(res.data.kingExp).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('领取远征宝箱', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('领取远征宝箱', function (done) {
|
function checkExpeditionWarRecord(expeditionWarRecords) {
|
||||||
done();
|
expect(expeditionWarRecords).to.be.an('array');
|
||||||
});
|
expeditionWarRecords.forEach(record => {
|
||||||
|
expect(record.expeditionId).to.be.a('number');
|
||||||
|
expect(record.battleCode).to.be.a('string');
|
||||||
|
expect(record.battleId).to.be.a('number');
|
||||||
|
expect(record.battleStatus).to.be.a('number');
|
||||||
|
expect(record.ce).to.be.a('number');
|
||||||
|
})
|
||||||
|
for(let record of expeditionWarRecords) {
|
||||||
|
if(record.battleStatus == 0) {
|
||||||
|
expeditionWarRecord = record;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPointRewards(pointRewards) {
|
||||||
|
expect(pointRewards).to.be.an('object');
|
||||||
|
expect(pointRewards.expeditionPoint).to.be.a('number');
|
||||||
|
expect(pointRewards.rewards).to.be.an('array');
|
||||||
|
pointRewards.rewards.forEach(reward => {
|
||||||
|
expect(reward.point).to.be.a('number');
|
||||||
|
expect(reward.received).to.be.a('boolean');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
it('获取秘境数据', function (done) {
|
it('获取秘境数据', function (done) {
|
||||||
|
pinusClient.request('battle.dungeonBattleHandler.getData', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.nextCostGold).to.be.a('number');
|
||||||
|
expect(res.data.battleCount).to.be.a('number');
|
||||||
|
expect(res.data.dungeonHeroes).to.be.an('array');
|
||||||
|
res.data.dungeonHeroes.forEach(data => {
|
||||||
|
expect(data.heroes).to.be.an('array');
|
||||||
|
data.heroes.forEach(hero => {
|
||||||
|
expect(hero).to.be.a('number');
|
||||||
|
});
|
||||||
|
expect(data.battleId).to.be.a('number');
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('购买秘境挑战次数', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('购买秘境挑战次数', function (done) {
|
it.skip('秘境关卡挑战开始', function (done) {
|
||||||
done();
|
pinusClient.request('battle.dungeonBattleHandler.debugResetRefTime', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
|
checkSuccessResponse(res, false);
|
||||||
|
checkBattle(pinusClient, [], DUNGEON_BATTLEID, 'dungeon', data => {
|
||||||
|
battleCode = data.battleCode;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('秘境关卡挑战开始', function (done) {
|
it.skip('秘境关卡挑战结束', function (done) {
|
||||||
done();
|
battleEnd(pinusClient, [], DUNGEON_BATTLEID, battleCode, 'dungeon', () => {
|
||||||
});
|
done();
|
||||||
|
})
|
||||||
it('秘境关卡挑战结束', function (done) {
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('获取秘境首通信息', function (done) {
|
it('获取秘境首通信息', function (done) {
|
||||||
|
pinusClient.request('battle.dungeonBattleHandler.getFirstInfo', { movePoint: 27 }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.infos).to.be.an('array');
|
||||||
|
res.data.infos.forEach(info => {
|
||||||
|
expect(info.warId).to.be.a('number');
|
||||||
|
checkTimeStamp(info.time, 10, true);
|
||||||
|
expect(info.userInfo).of.be.an('object');
|
||||||
|
expect(info.userInfo.roleId).to.be.a('string');
|
||||||
|
expect(info.userInfo.roleName).to.be.a('string');
|
||||||
|
expect(info.userInfo.head).to.be.a('number');
|
||||||
|
expect(info.userInfo.frame).to.be.a('number');
|
||||||
|
expect(info.userInfo.spine).to.be.a('number');
|
||||||
|
expect(info.userInfo.lv).to.be.a('number');
|
||||||
|
expect(info.userInfo.title).to.be.a('number');
|
||||||
|
expect(info.userInfo.guildName).to.be.a('string');
|
||||||
|
expect(info.userInfo.ce).to.be.a('number');
|
||||||
|
expect(info.lineup).to.be.an('array');
|
||||||
|
info.lineup.forEach(hero => {
|
||||||
|
expect(hero.hid).to.be.a('number');
|
||||||
|
expect(hero.star).to.be.a('number');
|
||||||
|
expect(hero.colorStar).to.be.a('number');
|
||||||
|
expect(hero.lv).to.be.a('number');
|
||||||
|
expect(hero.quality).to.be.a('number');
|
||||||
|
expect(hero.job).to.be.a('number');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let progress;
|
||||||
|
let towerLv;
|
||||||
|
it('获取天梯初始数据', function (done) {
|
||||||
|
pinusClient.request('battle.towerBattleHandler.getStatus', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.canHungUp).to.be.a('boolean');
|
||||||
|
expect(res.data.hungUpEnableLv).to.be.a('number');
|
||||||
|
expect(res.data.canSendTask).to.be.a('boolean');
|
||||||
|
expect(res.data.curLv).to.be.a('number');
|
||||||
|
towerLv = res.data.curLv;
|
||||||
|
expect(res.data.progress).to.be.an('array');
|
||||||
|
res.data.progress.forEach(data => {
|
||||||
|
expect(data.warId).to.be.a('number');
|
||||||
|
expect(data.status).to.be.a('boolean');
|
||||||
|
});
|
||||||
|
progress = res.data.progress;
|
||||||
|
expect(res.data.usedHeroes).to.be.an('array');
|
||||||
|
res.data.usedHeroes.forEach(hero => {
|
||||||
|
expect(hero).to.be.a('number');
|
||||||
|
})
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('重置天梯当前层的挑战记录', function (done) {
|
||||||
|
pinusClient.request('battle.towerBattleHandler.resetLv', { towerLv }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.roleId).to.be.a('string');
|
||||||
|
expect(res.data.lv).to.be.a('number');
|
||||||
|
expect(res.data.heroes).to.be.an('array');
|
||||||
|
res.data.heroes.forEach(hero => {
|
||||||
|
expect(hero).to.be.a('number');
|
||||||
|
})
|
||||||
|
expect(res.data.warStatus).to.be.an('array');
|
||||||
|
res.data.warStatus.forEach(war => {
|
||||||
|
expect(war.warId).to.be.a('number');
|
||||||
|
expect(war.status).to.be.a('boolean');
|
||||||
|
});
|
||||||
|
progress = res.data.warStatus;
|
||||||
|
expect(res.data.speedUpCnt).to.be.a('number');
|
||||||
|
expect(res.data.speedUpTime).to.be.a('number');
|
||||||
|
expect(res.data.passed).to.be.a('boolean');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('天梯关卡开始挑战', function (done) {
|
||||||
|
let war = progress.find(cur => !cur.status);
|
||||||
|
battleId = war.warId;
|
||||||
|
checkBattle(pinusClient, [], battleId, 'tower', data => {
|
||||||
|
battleCode = data.battleCode;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('天梯关卡结束挑战', function (done) {
|
||||||
|
battleEnd(pinusClient, [], battleId, battleCode, 'tower', () => {
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
it('查询当前挂机收益', function (done) {
|
||||||
|
pinusClient.request('battle.towerBattleHandler.checkHangUpRewards', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.startTime).to.be.a('string');
|
||||||
|
expect(res.data.hangUpPassTime).to.be.a('number');
|
||||||
|
checkDisplayItems(res.data.rewards);
|
||||||
|
expect(res.data.hangUpSpdUpCnt).to.be.a('number');
|
||||||
|
expect(res.data.nextCostGold).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('领取挂机收益', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('挂机加速', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('获取天梯派遣任务', function (done) {
|
||||||
|
pinusClient.request('battle.towerBattleHandler.getTasks', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkTowerTasks(res.data.curTasks);
|
||||||
|
|
||||||
|
expect(res.data.refRemainTime).to.be.a('number');
|
||||||
|
expect(res.data.nextCostGold).to.be.a('number');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkTowerTasks(tasks) {
|
||||||
|
expect(tasks).to.be.an('array');
|
||||||
|
tasks.forEach(task => {
|
||||||
|
expect(task.batchCode).to.be.an('string');
|
||||||
|
expect(task.status).to.be.a('number');
|
||||||
|
expect(task.taskId).to.be.a('number');
|
||||||
|
expect(task.taskCode).to.be.a('string');
|
||||||
|
if(task.status == 2) expect(task.completeTime).to.be.a('string');
|
||||||
|
expect(task.heroes).to.be.an('array');
|
||||||
|
task.heroes.forEach(hero => {
|
||||||
|
expect(hero.seqId).to.be.a('number');
|
||||||
|
expect(hero.hid).to.be.a('number');
|
||||||
|
expect(hero.skinId).to.be.a('number');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
it.skip('天梯刷新任务', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('天梯派遣某个武将到某个任务', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('领取奖励', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getParamHeroes(roleInfo) {
|
function getParamHeroes(roleInfo) {
|
||||||
@@ -194,11 +587,21 @@ function checkBattle(pinusClient, heroes, battleId, type, cb) {
|
|||||||
expect(res.data.status).to.equal(0);
|
expect(res.data.status).to.equal(0);
|
||||||
|
|
||||||
if(type == 'daily') {
|
if(type == 'daily') {
|
||||||
|
expect(res.data.dailyNum).to.be.an('object');
|
||||||
|
expect(res.data.dailyNum.type).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.count).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.buyCount).to.be.a('number');
|
||||||
} else if (type == 'tower') {
|
} else if (type == 'tower') {
|
||||||
|
expect(res.data.towerData.heroes).to.be.an('array');
|
||||||
|
res.data.towerData.heroes.forEach(hero => {
|
||||||
|
expect(hero).to.be.a('number');
|
||||||
|
})
|
||||||
|
expect(res.data.towerData.warStatus).to.be.an('object');
|
||||||
|
expect(res.data.towerData.warStatus.warId).to.be.a('number');
|
||||||
|
expect(res.data.towerData.warStatus.status).to.be.a('boolean');
|
||||||
} else if (type == 'dungeon') {
|
} else if (type == 'dungeon') {
|
||||||
|
expect(res.data.battleCount).to.be.a('number');
|
||||||
|
expect(res.data.buyCount).to.be.a('number');
|
||||||
}
|
}
|
||||||
cb(res.data, heroes);
|
cb(res.data, heroes);
|
||||||
});
|
});
|
||||||
@@ -226,11 +629,20 @@ function battleEnd(pinusClient, heroes, battleId, battleCode, type, cb) {
|
|||||||
expect(res.data.kingExp).to.be.a('number');
|
expect(res.data.kingExp).to.be.a('number');
|
||||||
checkActorData(res.data.actordata);
|
checkActorData(res.data.actordata);
|
||||||
if(type == 'daily') {
|
if(type == 'daily') {
|
||||||
|
expect(res.data.dailyNum).to.be.an('object');
|
||||||
|
expect(res.data.dailyNum.type).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.count).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.buyCount).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.war).to.be.an('object');
|
||||||
|
expect(res.data.dailyNum.war.battleId).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.war.cost).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.war.star).to.be.a('number');
|
||||||
|
expect(res.data.dailyNum.war.status).to.be.a('number');
|
||||||
} else if (type == 'tower') {
|
} else if (type == 'tower') {
|
||||||
|
|
||||||
} else if (type == 'dungeon') {
|
} else if (type == 'dungeon') {
|
||||||
|
expect(res.data.battleCount).to.be.a('number');
|
||||||
|
expect(res.data.buyCount).to.be.a('number');
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(res.data);
|
cb(res.data);
|
||||||
|
|||||||
118
game-server/test/equip.test.ts
Normal file
118
game-server/test/equip.test.ts
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
import { Client } from './Client';
|
||||||
|
import 'mocha';
|
||||||
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
import { addItemsIfNotEnough, checkDisplayItems, checkSuccessResponse, checkTimeStamp, checkWarJson } from './CheckPatten';
|
||||||
|
import { PVP } from '../app/pubUtils/dicParam';
|
||||||
|
import { DEBUG_MAGIC_WORD } from '../app/consts';
|
||||||
|
import { getRandSingleEelm } from '../app/pubUtils/util';
|
||||||
|
/*
|
||||||
|
describe('装备养成测试', function () {
|
||||||
|
let pinusClient: PinusWSClient;
|
||||||
|
let roleInfo;
|
||||||
|
|
||||||
|
before(function (done) {
|
||||||
|
const c = new Client();
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
if (c.client) {
|
||||||
|
pinusClient = c.client;
|
||||||
|
roleInfo = c.roleInfo;
|
||||||
|
clearInterval(timer);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(function (done) {
|
||||||
|
pinusClient.disconnect();
|
||||||
|
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||||
|
setTimeout(() => {
|
||||||
|
done();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('合成装备', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('分解装备', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('分解装备碎片', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('穿戴或卸载装备', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('一键穿戴装备', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备栏强化', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备栏一键强化到指定等级', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备栏精炼', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备洗炼锁定', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备洗炼', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备洗炼预览', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('放弃这条洗练', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备打孔', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('装备镶嵌', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('宝石合成', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('宝石卸下', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('宝石购买并合成', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('宝石升级下一级或并穿戴', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('藏宝图合成', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('淬火一次', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('淬火一品', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
@@ -289,7 +289,7 @@ describe('军团测试', function() {
|
|||||||
it('获取练兵场信息', function (done) {
|
it('获取练兵场信息', function (done) {
|
||||||
pinusClient.request('guild.guildTrainHandler.getTrainInstance', {}, (res) => {
|
pinusClient.request('guild.guildTrainHandler.getTrainInstance', {}, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
checkGuildTrain(res.data.guildTrain);
|
checkGuildTrain(res.data.guildTrain, 'main');
|
||||||
checkTrainCount(res.data)
|
checkTrainCount(res.data)
|
||||||
expect(res.data.buyTrainCount).to.be.a('number');
|
expect(res.data.buyTrainCount).to.be.a('number');
|
||||||
expect(res.data.trainLv).to.be.a('number');
|
expect(res.data.trainLv).to.be.a('number');
|
||||||
@@ -304,12 +304,12 @@ describe('军团测试', function() {
|
|||||||
expect(reward).to.be.a('number');
|
expect(reward).to.be.a('number');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function checkGuildTrain(guildTrain) {
|
function checkGuildTrain(guildTrain, from) {
|
||||||
expect(guildTrain.trainId).to.be.a('number');
|
expect(guildTrain.trainId).to.be.a('number');
|
||||||
trainId = guildTrain.trainId;
|
trainId = guildTrain.trainId;
|
||||||
expect(guildTrain.isComplete).to.be.a('boolean');
|
expect(guildTrain.isComplete).to.be.a('boolean');
|
||||||
checkTrainInstances(guildTrain.trainInstances);
|
checkTrainInstances(guildTrain.trainInstances);
|
||||||
if(guildTrain.reports) checkTrainReports(guildTrain.reports)
|
if(guildTrain.reports) checkTrainReports(guildTrain.reports, from)
|
||||||
if(guildTrain.trainBoxs) checkTrainBoxs(guildTrain.trainBoxs);
|
if(guildTrain.trainBoxs) checkTrainBoxs(guildTrain.trainBoxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,16 +324,20 @@ describe('军团测试', function() {
|
|||||||
trainInstances = data;
|
trainInstances = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkTrainReports(reports) {
|
function checkTrainReports(reports, from) {
|
||||||
expect(reports).to.be.an('array');
|
expect(reports).to.be.an('array');
|
||||||
reports.forEach(report => {
|
reports.forEach(report => {
|
||||||
expect(report.roleId).to.be.a('string');
|
expect(report.roleName).to.be.a('string');
|
||||||
expect(report.trainId).to.be.a('number');
|
expect(report.trainId).to.be.a('number');
|
||||||
expect(report.hid).to.be.a('number');
|
expect(report.hid).to.be.a('number');
|
||||||
expect(report.score).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');
|
expect(report.type).to.be.a('number');
|
||||||
|
expect(report.time).to.be.a('number');
|
||||||
|
if(from == 'battleEnd') {
|
||||||
|
expect(report.isSuccessed).to.be.a('boolean');
|
||||||
|
} else if (from == 'getreport') {
|
||||||
|
expect(report.difficulty).to.be.a('number');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,19 +386,39 @@ describe('军团测试', function() {
|
|||||||
pinusClient.request('guild.guildTrainHandler.trainBattleEnd', { battleCode, isSuccess: true }, (res) => {
|
pinusClient.request('guild.guildTrainHandler.trainBattleEnd', { battleCode, isSuccess: true }, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
checkDisplayItems(res.data.battleGoods);
|
checkDisplayItems(res.data.battleGoods);
|
||||||
checkGuildTrain(res.data.guildTrain);
|
checkGuildTrain(res.data.guildTrain, 'battleEnd');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('获得练兵场战报', function (done) {
|
it('获得练兵场战报', function (done) {
|
||||||
done();
|
pinusClient.request('guild.guildTrainHandler.getTrainReports', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkTrainReports(res.data.reports, 'getreport');
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('获得炼器堂', function (done) {
|
it('获得炼器堂', function (done) {
|
||||||
done();
|
pinusClient.request('guild.guildRefineHandler.getRefine', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkScienceTrees(res.data.scienceTrees);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkScienceTrees(scienceTrees) {
|
||||||
|
expect(scienceTrees).to.be.an('array');
|
||||||
|
scienceTrees.forEach(scienceTree => {
|
||||||
|
expect(scienceTree.assistRoleIds).to.be.an('array');
|
||||||
|
scienceTree.assistRoleIds.forEach(roleId => {
|
||||||
|
expect(roleId).to.be.a('string');
|
||||||
|
})
|
||||||
|
expect(scienceTree.id).to.be.a('number');
|
||||||
|
checkTimeStamp(scienceTree.endTime, 10, true);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
it.skip('点亮研发', function (done) {
|
it.skip('点亮研发', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -404,9 +428,36 @@ describe('军团测试', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('获得许愿池数据', function (done) {
|
it('获得许愿池数据', function (done) {
|
||||||
done();
|
pinusClient.request('guild.wishPoolHandler.getWishPool', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.list).to.be.an('array');
|
||||||
|
res.data.list.forEach(pool => {
|
||||||
|
expect(pool.type).to.be.a('number');
|
||||||
|
expect(pool.goodId).to.be.a('number');
|
||||||
|
expect(pool.count).to.be.a('number');
|
||||||
|
expect(pool.receiveCnt).to.be.a('number');
|
||||||
|
expect(pool.drawCnt).to.be.a('number');
|
||||||
|
expect(pool.id).to.be.a('string');
|
||||||
|
expect(pool.roleId).to.be.a('number');
|
||||||
|
});
|
||||||
|
expect(res.data.wishDntCnt).to.be.a('number');
|
||||||
|
checkWishGoods(res.data.wishGoods);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkWishGoods(wishGoods) {
|
||||||
|
expect(wishGoods).to.be.an('array');
|
||||||
|
wishGoods.forEach(good => {
|
||||||
|
expect(good.type).to.be.a('number');
|
||||||
|
expect(good.goodId).to.be.a('number');
|
||||||
|
expect(good.count).to.be.a('number');
|
||||||
|
expect(good.receiveCnt).to.be.a('number');
|
||||||
|
expect(good.drawCnt).to.be.a('number');
|
||||||
|
expect(good.id).to.be.a('string');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
it.skip('许愿', function (done) {
|
it.skip('许愿', function (done) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ describe('粮草先行测试', function () {
|
|||||||
pinusClient.on('onRaceHorseUpdate', (res) => {
|
pinusClient.on('onRaceHorseUpdate', (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
checkTimeStamp(res.data.timestamp, 13, false);
|
checkTimeStamp(res.data.timestamp, 13, false);
|
||||||
checkWoodenHorse(res.data.woodenHorseList);
|
checkWoodenHorses(res.data.woodenHorseList);
|
||||||
checkGuildRanks(res.data.guildRank, aid);
|
checkGuildRanks(res.data.guildRank, aid);
|
||||||
checkGuildRank(res.data.myGuildRank, aid);
|
checkGuildRank(res.data.myGuildRank, aid);
|
||||||
checkEvents(res.data.memberRank);
|
checkEvents(res.data.memberRank);
|
||||||
@@ -454,9 +454,12 @@ describe('粮草先行测试', function () {
|
|||||||
|
|
||||||
function debugStart(pinusClient, aid, cb) {
|
function debugStart(pinusClient, aid, cb) {
|
||||||
checkEventActivityStatus(pinusClient);
|
checkEventActivityStatus(pinusClient);
|
||||||
|
let week = aid == 1? 3: (aid == 2? 2: 1);
|
||||||
|
|
||||||
pinusClient.request('guild.gateActivityHandler.debugStartActivity', { aid }, (res) => {
|
pinusClient.request('guild.gateActivityHandler.debugSetDay', { week }, (res) => {
|
||||||
cb();
|
pinusClient.request('guild.gateActivityHandler.debugStartActivity', { aid }, (res) => {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
80
game-server/test/hero.test.ts
Normal file
80
game-server/test/hero.test.ts
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import { Client } from './Client';
|
||||||
|
import 'mocha';
|
||||||
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
import { addItemsIfNotEnough, checkDisplayItems, checkSuccessResponse, checkTimeStamp, checkWarJson } from './CheckPatten';
|
||||||
|
import { PVP } from '../app/pubUtils/dicParam';
|
||||||
|
import { DEBUG_MAGIC_WORD } from '../app/consts';
|
||||||
|
import { getRandSingleEelm } from '../app/pubUtils/util';
|
||||||
|
|
||||||
|
/*
|
||||||
|
describe('武将养成测试', function () {
|
||||||
|
let pinusClient: PinusWSClient;
|
||||||
|
let roleInfo;
|
||||||
|
|
||||||
|
before(function (done) {
|
||||||
|
const c = new Client();
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
if (c.client) {
|
||||||
|
pinusClient = c.client;
|
||||||
|
roleInfo = c.roleInfo;
|
||||||
|
clearInterval(timer);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(function (done) {
|
||||||
|
pinusClient.disconnect();
|
||||||
|
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||||
|
setTimeout(() => {
|
||||||
|
done();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将合成', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将升级', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将升星', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将觉醒', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将升品', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将训练', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将进阶', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将羁绊(激活+升级)', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('武将增加好感', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('穿戴时装', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('穿戴时装', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
*/
|
||||||
91
game-server/test/role.test.ts
Normal file
91
game-server/test/role.test.ts
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
import { Client } from './Client';
|
||||||
|
import 'mocha';
|
||||||
|
import { PinusWSClient } from 'pinus-robot-plugin';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
import { addItemsIfNotEnough, checkDisplayItems, checkSuccessResponse, checkTimeStamp, checkWarJson } from './CheckPatten';
|
||||||
|
import { PVP } from '../app/pubUtils/dicParam';
|
||||||
|
import { DEBUG_MAGIC_WORD } from '../app/consts';
|
||||||
|
import { getRandSingleEelm } from '../app/pubUtils/util';
|
||||||
|
|
||||||
|
/*
|
||||||
|
describe('全局养成测试', function () {
|
||||||
|
let pinusClient: PinusWSClient;
|
||||||
|
let roleInfo;
|
||||||
|
|
||||||
|
before(function (done) {
|
||||||
|
const c = new Client();
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
if (c.client) {
|
||||||
|
pinusClient = c.client;
|
||||||
|
roleInfo = c.roleInfo;
|
||||||
|
clearInterval(timer);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(function (done) {
|
||||||
|
pinusClient.disconnect();
|
||||||
|
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||||
|
setTimeout(() => {
|
||||||
|
done();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('爵位升级', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('获得百家学宫', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('百家学宫摆放/替换/卸下武将', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('百家学宫解锁位置', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('获得名将谱激活状态', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('激活/升级名将谱', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('神像强化', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('神像进阶', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('神像强化', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('保存展示阵容', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('更换头像', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('更换相框', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('更换形象', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('重命名', function (done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user