测试:添加战斗测试
This commit is contained in:
@@ -19,7 +19,7 @@ describe('pvp测试', function () {
|
||||
let receivedBox = [];
|
||||
let hisScore = 0;
|
||||
|
||||
beforeEach(function (done) {
|
||||
before(function (done) {
|
||||
const c = new Client();
|
||||
const timer = setInterval(() => {
|
||||
if (c.client) {
|
||||
@@ -31,7 +31,7 @@ describe('pvp测试', function () {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
after(function (done) {
|
||||
pinusClient.disconnect();
|
||||
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||
setTimeout(() => {
|
||||
@@ -337,6 +337,20 @@ describe('pvp测试', function () {
|
||||
});
|
||||
|
||||
|
||||
it('获得战报', function(done) {
|
||||
pinusClient.request('battle.pvpHandler.getRec', { }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.list).to.be.a('array');
|
||||
res.data.list.forEach(rec => {
|
||||
expect(rec.roleId1).to.be.a('string');
|
||||
expect(rec.roleId2).to.be.a('string');
|
||||
expect(rec.warId).to.be.a('number');
|
||||
checkRecInfo(rec.attackInfo);
|
||||
checkRecInfo(rec.defenseInfo);
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -474,4 +488,34 @@ function checkOldSeasonData(oldSeasonData) {
|
||||
expect(oldSeasonData.seasonNum).to.be.a('number');
|
||||
checkTimeStamp(oldSeasonData.seasonEndTime, 10, true);
|
||||
expect(oldSeasonData.rankLv).to.be.a('number');
|
||||
}
|
||||
|
||||
|
||||
function checkRecInfo(info) {
|
||||
expect(info.roleId).to.be.a('string');
|
||||
expect(info.roleName).to.be.a('string');
|
||||
expect(info.lv).to.be.a('number');
|
||||
expect(info.spine).to.be.a('number');
|
||||
expect(info.head).to.be.a('number');
|
||||
expect(info.frame).to.be.a('number');
|
||||
expect(info.title).to.be.a('number');
|
||||
expect(info.ce).to.be.a('number');
|
||||
expect(info.isSuccess).to.be.a('boolean');
|
||||
expect(info.score).to.be.a('number');
|
||||
checkRecHero(info.heroes);
|
||||
}
|
||||
|
||||
function checkRecHero(heroes) {
|
||||
expect(heroes).to.be.an('array');
|
||||
heroes.forEach(hero => {
|
||||
expect(hero.hid).to.be.a('number');
|
||||
expect(hero.skinId).to.be.a('number');
|
||||
expect(hero.quality).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.damage).to.be.a('number');
|
||||
expect(hero.heal).to.be.a('number');
|
||||
expect(hero.underDamage).to.be.a('number');
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user