测试:添加战斗测试

This commit is contained in:
luying
2021-11-03 20:04:06 +08:00
parent 88e7ee906d
commit fb59fcd0ca
13 changed files with 364 additions and 22 deletions

View File

@@ -11,7 +11,7 @@ describe('任务测试', function () {
let pinusClient: PinusWSClient;
let roleInfo;
beforeEach(function (done) {
before(function (done) {
const c = new Client();
const timer = setInterval(() => {
if (c.client) {
@@ -23,7 +23,7 @@ describe('任务测试', function () {
}, 1000);
});
afterEach(function (done) {
after(function (done) {
pinusClient.disconnect();
// disconnect 后等待 500ms供服务器清理环境、退出频道等
setTimeout(() => {
@@ -35,6 +35,7 @@ describe('任务测试', function () {
checkMainTask(roleInfo.mainTask);
checkDailyTask(roleInfo.dailyTask);
checkAchievement(roleInfo.achievement);
checkPvpTask(roleInfo.pvpTask);
done();
});
@@ -85,6 +86,9 @@ describe('任务测试', function () {
});
});
it('检查领取pvp任务', function (done) {
checkReceiveTask(pinusClient, done, TASK_FUN_TYPE.PVP);
});
it('领取每周活跃奖励', function (done) {
checkReceiveBox(pinusClient, done, TASK_FUN_TYPE.DAILY)
@@ -164,6 +168,13 @@ function checkAchievement(achievement) {
})
}
// 检查pvp任务数据
function checkPvpTask(pvpTask) {
if (!pvpTask) return;
expect(pvpTask.taskList).to.be.an('array');
pvpTask.taskList.forEach(task => checkSingleTask(task));
}
// 检查在taskList中的某一个任务数据
function checkSingleTask(task) {
expect(task).to.be.an('object');