拍卖行:初步实现添加拍品的测试接口

This commit is contained in:
liangtongchuan
2021-03-17 16:14:22 +08:00
parent a76c0fa7fe
commit 76aee57e67
4 changed files with 48 additions and 9 deletions
+21 -2
View File
@@ -1,10 +1,25 @@
import { AUCTION_SOURCE } from './../app/consts/constModules/auctionConst';
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_PRIVATE_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS, HERO_GROW_MAX, ABI_STAGE } from './../app/consts';
import { Client } from './Client';
import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { checkSuccessResponse } from './CheckPatten';
import { DEBUG_MAGIC_WORD, AUCTION_SOURCE } from '../app/consts';
function checkLot(lot) {
expect(lot.auctionStage).to.be.a('number');
expect(lot.sourceType).to.be.a('number');
expect(lot.sourceCode).to.be.a('string');
expect(lot.serverId).to.be.a('number');
expect(lot.guildCode).to.be.a('string');
expect(lot.code).to.be.a('string');
expect(lot.gid).to.be.a('number');
expect(lot.count).to.be.a('number');
expect(lot.maxPrice).to.be.a('number');
expect(lot.curPrice).to.be.a('number');
expect(lot.bidRoles).to.be.a('array');
expect(Date.parse(lot.begin)).to.be.a('number');
expect(Date.parse(lot.end)).to.be.a('number');
}
describe('拍卖行测试', function() {
let pinusClient: PinusWSClient;
@@ -40,6 +55,10 @@ describe('拍卖行测试', function() {
const sourceCode = Math.random().toString(36).slice(-8);
pinusClient.request('battle.auctionHandler.debugAddLots', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, sourceCode, rewards: [{ id: 1, count: 1 }, { id: 2, count: 2 }] }, (res) => {
checkSuccessResponse(res);
expect(res.data.lots).to.be.an('array');
for (let lot of res.data.lots) {
checkLot(lot);
}
done();
});
});
+1 -1
View File
@@ -10,7 +10,7 @@ function checkTime(date: Date, h: number, m: number, s: number) {
expect(date.getSeconds()).to.be.equal(s);
}
describe('测试时间相关工具方法', function () {
describe('测试时间工具方法', function () {
it('获取某个时间后的某点,返回当天', function () {
const baseDate = new Date();
const newHour = 9, newMin = 9, newSec = 9;