feat(gvgBattle): 填充接口,通过部分激战期用例测试

This commit is contained in:
liangtongchuan
2023-02-03 22:27:27 +08:00
committed by luying
parent 31a286d82e
commit 92191cbcca
5 changed files with 95 additions and 22 deletions

View File

@@ -1,3 +1,4 @@
import { DEBUG_MAGIC_WORD } from '../../shared/consts';
import { GVGTeamType } from './../../shared/db/GVGTeam';
import { GVGUserDataType } from './../../shared/db/GVGUserData';
import { LineupHero } from './../../shared/domain/roleField/hero';
@@ -7,7 +8,7 @@ import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { checkSuccessResponse } from './CheckPatten';
describe.skip('gvg激战期测试', function () {
describe('gvg激战期测试', function () {
let pinusClient: PinusWSClient;
let roleInfo;
@@ -58,13 +59,21 @@ describe.skip('gvg激战期测试', function () {
// 测试获取城池信息
it('测试获取城池信息', function (done) {
const cityId = 1;
pinusClient.request('guild.gvgBattleHandler.getCity', {
cityId,
// 通过测试接口尝试创建城市
pinusClient.request('guild.gvgBattleHandler.createCity', {
cityId, magicWord: DEBUG_MAGIC_WORD
}, (data) => {
checkSuccessResponse(data);
// 检查返回值中的 city
console.log(JSON.stringify(data.data.city, null, 2));
checkCity(data.data.city);
done();
pinusClient.request('guild.gvgBattleHandler.getCity', {
cityId,
}, (data) => {
checkSuccessResponse(data);
// 检查返回值中的 city
checkCity(data.data.city);
done();
});
});
});
@@ -90,7 +99,7 @@ describe.skip('gvg激战期测试', function () {
});
// 开始移动
it('开始移动', function (done) {
it.skip('开始移动', function (done) {
const cityId = 1;
const areaId = 1;
const teamCode = '';
@@ -102,7 +111,7 @@ describe.skip('gvg激战期测试', function () {
checkSuccessResponse(data);
setTimeout(() => {
// 停止移动
it('停止移动', function (done) {
it.skip('停止移动', function (done) {
pinusClient.request('guild.gvgBattleHandler.stopMove', {}, (data) => {
checkSuccessResponse(data);
expect(data.data.areaId).to.be.a('number');
@@ -121,7 +130,7 @@ describe.skip('gvg激战期测试', function () {
});
// 队伍入驻积分点
it('队伍入驻积分点', function (done) {
it.skip('队伍入驻积分点', function (done) {
const cityId = 1;
const areaId = 1;
const pointId = 1;
@@ -139,7 +148,7 @@ describe.skip('gvg激战期测试', function () {
});
// 队伍离开积分点
it('队伍离开积分点', function (done) {
it.skip('队伍离开积分点', function (done) {
pinusClient.request('guild.gvgBattleHandler.teamLeave', {}, (data) => {
checkSuccessResponse(data);
done();
@@ -157,7 +166,7 @@ describe.skip('gvg激战期测试', function () {
expect(battleCode).to.be.a('string');
setTimeout(() => {
// 队伍结束攻击 battleEnd
it('队伍结束攻击', function (done) {
it.skip('队伍结束攻击', function (done) {
pinusClient.request('guild.gvgBattleHandler.battleEnd', {
battleCode,
isSuccess,
@@ -174,14 +183,14 @@ describe.skip('gvg激战期测试', function () {
}
// 队伍开始攻击且获胜
it('队伍开始攻击且获胜', function (done) {
it.skip('队伍开始攻击且获胜', function (done) {
const teamCode = '';
const oppoTeamCode = '';
battle(teamCode, oppoTeamCode, true, done);
});
// 队伍开始攻击且失败
it('队伍开始攻击且失败', function (done) {
it.skip('队伍开始攻击且失败', function (done) {
const teamCode = '';
const oppoTeamCode = '';
battle(teamCode, oppoTeamCode, false, done);
@@ -200,14 +209,14 @@ describe.skip('gvg激战期测试', function () {
// 使用道具
// ! 不同道具添加多个测试用例
it('使用道具', function (done) {
it.skip('使用道具', function (done) {
const itemId = 1;
const teamCode = '';
useItem(itemId, teamCode, done);
});
// 复活队伍
it('复活队伍', function (done) {
it.skip('复活队伍', function (done) {
const teamCode = '';
pinusClient.request('guild.gvgBattleHandler.reviveTeam', {}, (data) => {
checkSuccessResponse(data);
@@ -219,7 +228,10 @@ describe.skip('gvg激战期测试', function () {
// 获取战报 getRecs
// ! 战报具体内容未检查
it('获取战报', function (done) {
pinusClient.request('guild.gvgBattleHandler.getRecs', {}, (data) => {
const type = 1;
pinusClient.request('guild.gvgBattleHandler.getRecs', {
type,
}, (data) => {
checkSuccessResponse(data);
expect(data.data.recs).to.be.an('array');
done();
@@ -239,7 +251,7 @@ describe.skip('gvg激战期测试', function () {
});
// 获取区域上的队伍 getAreaTeams
it('获取区域上的队伍', function (done) {
it.skip('获取区域上的队伍', function (done) {
const cityId = 1;
const areaIds = [1, 2, 3];
pinusClient.request('guild.gvgBattleHandler.getAreaTeams', {