拍卖行:添加接口返回和测试框架,调整个别字段

This commit is contained in:
liangtongchuan
2021-03-17 14:52:15 +08:00
parent 023f7de8b9
commit 0dc4f18d2d
5 changed files with 140 additions and 10 deletions
+102
View File
@@ -0,0 +1,102 @@
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';
describe('拍卖行测试', function() {
let pinusClient: PinusWSClient;
let pinusClientT: PinusWSClient; // 用做测试队友
let roleInfo;
let roleInfoT;
beforeEach(function(done) {
const c = new Client();
const cT = new Client('13121622738');
const timer = setInterval(() => {
if (c.client && cT.client) {
pinusClient = c.client;
roleInfo = c.roleInfo;
pinusClientT = cT.client;
roleInfoT = cT.roleInfo;
clearInterval(timer);
done();
}
}, 500);
});
afterEach(function(done) {
pinusClient.disconnect();
pinusClientT.disconnect();
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
setTimeout(() => {
done();
}, 500);
});
it('添加拍品', function(done) {
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);
done();
});
});
it('获取拍卖行数据', function(done) {
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('出价', function(done) {
pinusClient.request('battle.auctionHandler.offer', { max: false }, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('出一口价', function(done) {
pinusClient.request('battle.auctionHandler.offer', { max: true }, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('关注', function(done) {
pinusClient.request('battle.auctionHandler.watchLot', { code: '' }, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('查看分红', function(done) {
pinusClient.request('battle.auctionHandler.checkDividend', {}, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('领取分红', function(done) {
pinusClient.request('battle.auctionHandler.getDividend', {}, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('查看我的关注', function(done) {
pinusClient.request('battle.auctionHandler.myOffers', {}, (res) => {
checkSuccessResponse(res, false);
done();
});
});
it('查看我的拍卖纪录', function(done) {
pinusClient.request('battle.auctionHandler.getAuction', { count: 10 }, (res) => {
checkSuccessResponse(res, false);
done();
});
});
});
+1 -1
View File
@@ -5,7 +5,7 @@ import { expect } from 'chai';
import { checkSuccessResponse } from './CheckPatten';
import { BLOCK_OPEATE } from '../app/consts';
describe('pvp测试', function() {
describe('好友测试测试', function() {
let pinusClient: PinusWSClient;
let pinusClientT: PinusWSClient; // 用做测试队友