测试:删除log
This commit is contained in:
+301
-312
@@ -10,353 +10,342 @@ const GOOD_ID_TIEJIAN = 1;
|
|||||||
const GOOD_ID_GANGJIAN = 2;
|
const GOOD_ID_GANGJIAN = 2;
|
||||||
|
|
||||||
function checkLot(lot) {
|
function checkLot(lot) {
|
||||||
expect(lot.auctionStage).to.be.a('number');
|
expect(lot.auctionStage).to.be.a('number');
|
||||||
expect(lot.sourceType).to.be.a('number');
|
expect(lot.sourceType).to.be.a('number');
|
||||||
expect(lot.sourceCode).to.be.a('string');
|
expect(lot.sourceCode).to.be.a('string');
|
||||||
expect(lot.serverId).to.be.a('number');
|
expect(lot.serverId).to.be.a('number');
|
||||||
expect(lot.guildCode).to.be.a('string');
|
expect(lot.guildCode).to.be.a('string');
|
||||||
expect(lot.code).to.be.a('string');
|
expect(lot.code).to.be.a('string');
|
||||||
expect(lot.gid).to.be.a('number');
|
expect(lot.gid).to.be.a('number');
|
||||||
expect(lot.count).to.be.a('number');
|
expect(lot.count).to.be.a('number');
|
||||||
expect(lot.maxPrice).to.be.a('number');
|
expect(lot.maxPrice).to.be.a('number');
|
||||||
expect(lot.curPrice).to.be.a('number');
|
expect(lot.curPrice).to.be.a('number');
|
||||||
expect(lot.bidRoles).to.be.a('array');
|
expect(lot.bidRoles).to.be.a('array');
|
||||||
expect(Date.parse(lot.begin)).to.be.a('number');
|
expect(Date.parse(lot.begin)).to.be.a('number');
|
||||||
expect(Date.parse(lot.end)).to.be.a('number');
|
expect(Date.parse(lot.end)).to.be.a('number');
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLots(lots) {
|
function checkLots(lots) {
|
||||||
for (let lot of lots) {
|
for (let lot of lots) {
|
||||||
checkLot(lot);
|
checkLot(lot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDividend(dividend) {
|
function checkDividend(dividend) {
|
||||||
expect(dividend.sourceType).to.be.a('number');
|
expect(dividend.sourceType).to.be.a('number');
|
||||||
expect(dividend.sourceCode).to.be.a('string');
|
expect(dividend.sourceCode).to.be.a('string');
|
||||||
expect(dividend.serverId).to.be.a('number');
|
expect(dividend.serverId).to.be.a('number');
|
||||||
expect(dividend.guildCode).to.be.a('string');
|
expect(dividend.guildCode).to.be.a('string');
|
||||||
expect(dividend.code).to.be.a('string');
|
expect(dividend.code).to.be.a('string');
|
||||||
expect(dividend.status).to.be.a('number');
|
expect(dividend.status).to.be.a('number');
|
||||||
expect(dividend.totalPrice).to.be.a('number');
|
expect(dividend.totalPrice).to.be.a('number');
|
||||||
expect(dividend.lots).to.be.an('array');
|
expect(dividend.lots).to.be.an('array');
|
||||||
expect(dividend.dividends).to.be.an('array');
|
expect(dividend.dividends).to.be.an('array');
|
||||||
expect(Date.parse(dividend.begin)).to.be.a('number');
|
expect(Date.parse(dividend.begin)).to.be.a('number');
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDividends(dividends) {
|
function checkDividends(dividends) {
|
||||||
for (let dividend of dividends) {
|
for (let dividend of dividends) {
|
||||||
checkDividend(dividend);
|
checkDividend(dividend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('拍卖行测试', function () {
|
describe('拍卖行测试', function () {
|
||||||
let pinusClient: PinusWSClient;
|
let pinusClient: PinusWSClient;
|
||||||
let pinusClientT: PinusWSClient; // 用做测试队友
|
let pinusClientT: PinusWSClient; // 用做测试队友
|
||||||
let roleInfo;
|
let roleInfo;
|
||||||
let roleInfoT;
|
let roleInfoT;
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
const c = new Client();
|
const c = new Client();
|
||||||
const cT = new Client('13121622738');
|
const cT = new Client('13121622738');
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
if (c.client && cT.client) {
|
if (c.client && cT.client) {
|
||||||
pinusClient = c.client;
|
pinusClient = c.client;
|
||||||
roleInfo = c.roleInfo;
|
roleInfo = c.roleInfo;
|
||||||
pinusClientT = cT.client;
|
pinusClientT = cT.client;
|
||||||
roleInfoT = cT.roleInfo;
|
roleInfoT = cT.roleInfo;
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
|
||||||
|
|
||||||
after(function (done) {
|
|
||||||
console.log('ddddddddddddddddddd');
|
|
||||||
pinusClient.disconnect();
|
|
||||||
pinusClientT.disconnect();
|
|
||||||
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
|
||||||
setTimeout(() => {
|
|
||||||
done();
|
|
||||||
console.log('ddddddddddddddddddd 1111');
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('添加拍品', function (done) {
|
|
||||||
const sourceCode = Math.random().toString(36).slice(-8);
|
|
||||||
console.log('XXXXXXXXXXXXXXXXX 1 ');
|
|
||||||
pinusClient.request('battle.auctionHandler.debugAddLots', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, sourceCode, rewards: [{ id: GOOD_ID_TIEJIAN, count: 1 }, { id: GOOD_ID_GANGJIAN, count: 2 }] }, (res) => {
|
|
||||||
console.log('XXXXXXXXXXXXXXXXX 1 ', JSON.stringify(res))
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
expect(res.data.lots).to.be.an('array');
|
|
||||||
for (let lot of res.data.lots) {
|
|
||||||
checkLot(lot);
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('获取拍卖行数据', function (done) {
|
after(function (done) {
|
||||||
console.log('XXXXXXXXXXXXXXXXX 2 ', '获取拍卖行数据')
|
pinusClient.disconnect();
|
||||||
try {
|
pinusClientT.disconnect();
|
||||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||||
console.log('XXXXXXXXXXXXXXXXX 2 ', JSON.stringify(res))
|
setTimeout(() => {
|
||||||
checkSuccessResponse(res);
|
done();
|
||||||
|
}, 500);
|
||||||
expect(res.data.lots).to.be.an('array');
|
|
||||||
checkLots(res.data.lots);
|
|
||||||
expect(res.data.dividends).to.be.an('array');
|
|
||||||
checkDividends(res.data.dividends);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.log('offer got err:', e);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('出价,竞价和一口价', function (done) {
|
|
||||||
let gid = null;
|
|
||||||
pinusClient.on('onEquipAdd', (res) => {
|
|
||||||
console.log('XXXXXXXXXXXXXXXXX 3', JSON.stringify(res))
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
expect(res.data.equipInfos).to.be.an('array');
|
|
||||||
for (let info of res.data.equipInfos) {
|
|
||||||
expect(info.id).to.be.equal(gid);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
it('添加拍品', function (done) {
|
||||||
expect(res.data.lots).to.be.an('array');
|
const sourceCode = Math.random().toString(36).slice(-8);
|
||||||
checkLots(res.data.lots);
|
pinusClient.request('battle.auctionHandler.debugAddLots', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, sourceCode, rewards: [{ id: GOOD_ID_TIEJIAN, count: 1 }, { id: GOOD_ID_GANGJIAN, count: 2 }] }, (res) => {
|
||||||
expect(res.data.dividends).to.be.an('array');
|
checkSuccessResponse(res);
|
||||||
checkDividends(res.data.dividends);
|
expect(res.data.lots).to.be.an('array');
|
||||||
if (res.data.lots.length === 0) {
|
for (let lot of res.data.lots) {
|
||||||
console.warn('没有拍品');
|
checkLot(lot);
|
||||||
done();
|
}
|
||||||
return;
|
done();
|
||||||
}
|
});
|
||||||
let unsoldLots = res.data.lots.filter(lot => { return lot.status !== LOT_STATUS.SOLD && lot.curBuyer !== roleInfo.roleId });
|
});
|
||||||
if (unsoldLots.length === 0) {
|
|
||||||
console.warn('没有可出价的拍品');
|
it('获取拍卖行数据', function (done) {
|
||||||
done();
|
try {
|
||||||
return;
|
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||||
}
|
checkSuccessResponse(res);
|
||||||
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: false }, (res) => {
|
|
||||||
console.log('XXXXXXXXXXXXXXXXX 4 ', JSON.stringify(res))
|
expect(res.data.lots).to.be.an('array');
|
||||||
checkSuccessResponse(res);
|
checkLots(res.data.lots);
|
||||||
checkLot(res.data.lot);
|
expect(res.data.dividends).to.be.an('array');
|
||||||
if (res.data.dividend) {
|
checkDividends(res.data.dividends);
|
||||||
checkDividend(res.data.dividend);
|
done();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('offer got err:', e);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
expect(res.data.lot.curBuyer).to.be.equal(roleInfo.roleId);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
unsoldLots.shift();
|
|
||||||
if (unsoldLots.length === 0) {
|
|
||||||
console.warn('没有测试一口价的情况');
|
|
||||||
done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gid = unsoldLots[0].gid;
|
|
||||||
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: true }, (res) => {
|
|
||||||
console.log('XXXXXXXXXXXXXXXXX 5 ', JSON.stringify(res))
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
checkLot(res.data.lot);
|
|
||||||
checkDividend(res.data.dividend);
|
|
||||||
expect(res.data.lot.curBuyer).to.be.equal(roleInfo.roleId);
|
|
||||||
setTimeout(() => {
|
|
||||||
done();
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('关注后取关', function (done) {
|
it('出价,竞价和一口价', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
let gid = null;
|
||||||
console.log('XXXXXXXXXXXXXXXXX 6 ', JSON.stringify(res))
|
pinusClient.on('onEquipAdd', (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
expect(res.data.lots).to.be.an('array');
|
expect(res.data.equipInfos).to.be.an('array');
|
||||||
checkLots(res.data.lots);
|
for (let info of res.data.equipInfos) {
|
||||||
expect(res.data.dividends).to.be.an('array');
|
expect(info.id).to.be.equal(gid);
|
||||||
checkDividends(res.data.dividends);
|
}
|
||||||
if (res.data.lots.length === 0) {
|
|
||||||
console.warn('没有可关注的拍品');
|
|
||||||
done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const code = res.data.lots[0].code;
|
|
||||||
pinusClient.request('battle.auctionHandler.watchLot', { code }, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
checkLot(res.data.lot);
|
|
||||||
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.above(-1);
|
|
||||||
pinusClient.request('battle.auctionHandler.unWatchLot', { code }, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
checkLot(res.data.lot);
|
|
||||||
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.equal(-1);
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||||
});
|
checkSuccessResponse(res);
|
||||||
});
|
expect(res.data.lots).to.be.an('array');
|
||||||
|
checkLots(res.data.lots);
|
||||||
it('查看分红', function (done) {
|
expect(res.data.dividends).to.be.an('array');
|
||||||
pinusClient.request('battle.auctionHandler.checkDividend', {}, (res) => {
|
checkDividends(res.data.dividends);
|
||||||
console.log('XXXXXXXXXXXXXXXXX 7 ', JSON.stringify(res))
|
if (res.data.lots.length === 0) {
|
||||||
checkSuccessResponse(res);
|
console.warn('没有拍品');
|
||||||
checkDividends(res.data.dividends);
|
done();
|
||||||
done();
|
return;
|
||||||
});
|
}
|
||||||
});
|
let unsoldLots = res.data.lots.filter(lot => { return lot.status !== LOT_STATUS.SOLD && lot.curBuyer !== roleInfo.roleId });
|
||||||
|
if (unsoldLots.length === 0) {
|
||||||
it('领取分红', function (done) {
|
console.warn('没有可出价的拍品');
|
||||||
pinusClient.on('onItemUpdate', (res) => {
|
done();
|
||||||
checkSuccessResponse(res);
|
return;
|
||||||
expect(res.data.goods).to.be.an('array');
|
}
|
||||||
for (let info of res.data.goods) {
|
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: false }, (res) => {
|
||||||
expect(info.id).to.be.equal(CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD));
|
checkSuccessResponse(res);
|
||||||
}
|
checkLot(res.data.lot);
|
||||||
});
|
if (res.data.dividend) {
|
||||||
pinusClient.request('battle.auctionHandler.debugSetDividendStatus', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, status: DIVIDEND_STATUS.END }, (res) => {
|
checkDividend(res.data.dividend);
|
||||||
checkSuccessResponse(res);
|
}
|
||||||
checkDividend(res.data.dividend);
|
expect(res.data.lot.curBuyer).to.be.equal(roleInfo.roleId);
|
||||||
// TODO: 找个测试领取分红的方法
|
done();
|
||||||
const dividend = res.data.dividend.dividends.find(d => { return d.roleId === roleInfo.roleId });
|
});
|
||||||
if (!dividend) {
|
unsoldLots.shift();
|
||||||
console.warn('未测试到领取分红的情况');
|
if (unsoldLots.length === 0) {
|
||||||
done();
|
console.warn('没有测试一口价的情况');
|
||||||
return;
|
done();
|
||||||
}
|
return;
|
||||||
pinusClient.request('battle.auctionHandler.getDividend', { sourceType: AUCTION_SOURCE.GATE }, (res) => {
|
}
|
||||||
checkSuccessResponse(res);
|
gid = unsoldLots[0].gid;
|
||||||
expect(res.data.dividend).to.be.an('object');
|
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: true }, (res) => {
|
||||||
expect(res.data.dividend.roleId).to.be.a('string');
|
checkSuccessResponse(res);
|
||||||
expect(res.data.dividend.posNum).to.be.a('number');
|
checkLot(res.data.lot);
|
||||||
expect(res.data.dividend.weekendNum).to.be.a('number');
|
checkDividend(res.data.dividend);
|
||||||
expect(res.data.dividend.total).to.be.a('number');
|
expect(res.data.lot.curBuyer).to.be.equal(roleInfo.roleId);
|
||||||
expect(res.data.dividend.status).to.be.a('number');
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
done();
|
||||||
done();
|
}, 100);
|
||||||
}, 100);
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('查看我的关注', function (done) {
|
|
||||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
expect(res.data.lots).to.be.an('array');
|
|
||||||
checkLots(res.data.lots);
|
|
||||||
expect(res.data.dividends).to.be.an('array');
|
|
||||||
checkDividends(res.data.dividends);
|
|
||||||
if (res.data.lots.length === 0) {
|
|
||||||
console.warn('没有可关注的拍品');
|
|
||||||
done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const code = res.data.lots[0].code;
|
|
||||||
pinusClient.request('battle.auctionHandler.watchLot', { code }, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
checkLot(res.data.lot);
|
|
||||||
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.above(-1);
|
|
||||||
pinusClient.request('battle.auctionHandler.myWatching', {}, (res) => {
|
|
||||||
checkSuccessResponse(res);
|
|
||||||
checkLots(res.data.lots);
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('更新拍品阶段的测试接口', function (done) {
|
it('关注后取关', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
expect(res.data.lots).to.be.an('array');
|
expect(res.data.lots).to.be.an('array');
|
||||||
checkLots(res.data.lots);
|
checkLots(res.data.lots);
|
||||||
expect(res.data.dividends).to.be.an('array');
|
expect(res.data.dividends).to.be.an('array');
|
||||||
checkDividends(res.data.dividends);
|
checkDividends(res.data.dividends);
|
||||||
if (res.data.lots.length === 0) {
|
if (res.data.lots.length === 0) {
|
||||||
console.warn('没有可更新阶段的拍品');
|
console.warn('没有可关注的拍品');
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const code = res.data.lots[0].code;
|
const code = res.data.lots[0].code;
|
||||||
pinusClient.request('battle.auctionHandler.debugSetLotStage', { code, magicWord: DEBUG_MAGIC_WORD, auctionStage: AUCTION_STAGE.GUILD }, (res) => {
|
pinusClient.request('battle.auctionHandler.watchLot', { code }, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
checkLot(res.data.lot);
|
checkLot(res.data.lot);
|
||||||
done();
|
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.above(-1);
|
||||||
});
|
pinusClient.request('battle.auctionHandler.unWatchLot', { code }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkLot(res.data.lot);
|
||||||
|
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.equal(-1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('查看我的拍卖纪录', function (done) {
|
it('查看分红', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.offerRecs', { count: 10 }, (res) => {
|
pinusClient.request('battle.auctionHandler.checkDividend', {}, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
expect(res.data.bidRecs).to.be.an('array');
|
checkDividends(res.data.dividends);
|
||||||
if (res.data.bidRecs.length === 0) {
|
done();
|
||||||
console.warn('没有我的拍卖纪录');
|
});
|
||||||
done();
|
});
|
||||||
return;
|
|
||||||
}
|
it('领取分红', function (done) {
|
||||||
for (let bidRec of res.data.bidRecs) {
|
pinusClient.on('onItemUpdate', (res) => {
|
||||||
expect(bidRec.roleId).to.be.a('string');
|
checkSuccessResponse(res);
|
||||||
expect(bidRec.price).to.be.a('number');
|
expect(res.data.goods).to.be.an('array');
|
||||||
expect(Date.parse(bidRec.time)).to.be.a('number');
|
for (let info of res.data.goods) {
|
||||||
expect(bidRec.status).to.be.a('number');
|
expect(info.id).to.be.equal(CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD));
|
||||||
expect(bidRec.gid).to.be.a('number');
|
}
|
||||||
}
|
});
|
||||||
done();
|
pinusClient.request('battle.auctionHandler.debugSetDividendStatus', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, status: DIVIDEND_STATUS.END }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkDividend(res.data.dividend);
|
||||||
|
// TODO: 找个测试领取分红的方法
|
||||||
|
const dividend = res.data.dividend.dividends.find(d => { return d.roleId === roleInfo.roleId });
|
||||||
|
if (!dividend) {
|
||||||
|
console.warn('未测试到领取分红的情况');
|
||||||
|
done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pinusClient.request('battle.auctionHandler.getDividend', { sourceType: AUCTION_SOURCE.GATE }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.dividend).to.be.an('object');
|
||||||
|
expect(res.data.dividend.roleId).to.be.a('string');
|
||||||
|
expect(res.data.dividend.posNum).to.be.a('number');
|
||||||
|
expect(res.data.dividend.weekendNum).to.be.a('number');
|
||||||
|
expect(res.data.dividend.total).to.be.a('number');
|
||||||
|
expect(res.data.dividend.status).to.be.a('number');
|
||||||
|
setTimeout(() => {
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('查看我的关注', function (done) {
|
||||||
|
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.lots).to.be.an('array');
|
||||||
|
checkLots(res.data.lots);
|
||||||
|
expect(res.data.dividends).to.be.an('array');
|
||||||
|
checkDividends(res.data.dividends);
|
||||||
|
if (res.data.lots.length === 0) {
|
||||||
|
console.warn('没有可关注的拍品');
|
||||||
|
done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const code = res.data.lots[0].code;
|
||||||
|
pinusClient.request('battle.auctionHandler.watchLot', { code }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkLot(res.data.lot);
|
||||||
|
expect(res.data.lot.watchingRoles.indexOf(roleInfo.roleId)).to.be.above(-1);
|
||||||
|
pinusClient.request('battle.auctionHandler.myWatching', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkLots(res.data.lots);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('更新拍品阶段的测试接口', function (done) {
|
||||||
|
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.lots).to.be.an('array');
|
||||||
|
checkLots(res.data.lots);
|
||||||
|
expect(res.data.dividends).to.be.an('array');
|
||||||
|
checkDividends(res.data.dividends);
|
||||||
|
if (res.data.lots.length === 0) {
|
||||||
|
console.warn('没有可更新阶段的拍品');
|
||||||
|
done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const code = res.data.lots[0].code;
|
||||||
|
pinusClient.request('battle.auctionHandler.debugSetLotStage', { code, magicWord: DEBUG_MAGIC_WORD, auctionStage: AUCTION_STAGE.GUILD }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
checkLot(res.data.lot);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('查看我的拍卖纪录', function (done) {
|
||||||
|
pinusClient.request('battle.auctionHandler.offerRecs', { count: 10 }, (res) => {
|
||||||
|
checkSuccessResponse(res);
|
||||||
|
expect(res.data.bidRecs).to.be.an('array');
|
||||||
|
if (res.data.bidRecs.length === 0) {
|
||||||
|
console.warn('没有我的拍卖纪录');
|
||||||
|
done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (let bidRec of res.data.bidRecs) {
|
||||||
|
expect(bidRec.roleId).to.be.a('string');
|
||||||
|
expect(bidRec.price).to.be.a('number');
|
||||||
|
expect(Date.parse(bidRec.time)).to.be.a('number');
|
||||||
|
expect(bidRec.status).to.be.a('number');
|
||||||
|
expect(bidRec.gid).to.be.a('number');
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('获取军团拍卖记录', function (done) {
|
it('获取军团拍卖记录', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.guildLotRecs', { count: 10 }, (res) => {
|
pinusClient.request('battle.auctionHandler.guildLotRecs', { count: 10 }, (res) => {
|
||||||
checkSuccessResponse(res);
|
checkSuccessResponse(res);
|
||||||
expect(res.data.lotRecs).to.be.an('array');
|
expect(res.data.lotRecs).to.be.an('array');
|
||||||
if (res.data.lotRecs.length === 0) {
|
if (res.data.lotRecs.length === 0) {
|
||||||
console.warn('没有军团拍卖纪录');
|
console.warn('没有军团拍卖纪录');
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let lotRec of res.data.lotRecs) {
|
for (let lotRec of res.data.lotRecs) {
|
||||||
expect(lotRec.price).to.be.a('number');
|
expect(lotRec.price).to.be.a('number');
|
||||||
expect(lotRec.count).to.be.a('number');
|
expect(lotRec.count).to.be.a('number');
|
||||||
expect(Date.parse(lotRec.time)).to.be.a('number');
|
expect(Date.parse(lotRec.time)).to.be.a('number');
|
||||||
expect(lotRec.gid).to.be.a('number');
|
expect(lotRec.gid).to.be.a('number');
|
||||||
expect(lotRec.sourceType).to.be.a('number');
|
expect(lotRec.sourceType).to.be.a('number');
|
||||||
expect(lotRec.max).to.be.a('boolean');
|
expect(lotRec.max).to.be.a('boolean');
|
||||||
expect(lotRec.sold).to.be.a('boolean');
|
expect(lotRec.sold).to.be.a('boolean');
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('测试接口,军团拍卖定时', function (done) {
|
it('测试接口,军团拍卖定时', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.debugScheduleStartGuild', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
pinusClient.request('battle.auctionHandler.debugScheduleStartGuild', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
checkSuccessResponse(res, false);
|
checkSuccessResponse(res, false);
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('测试接口,世界拍卖定时', function (done) {
|
it('测试接口,世界拍卖定时', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.debugScheduleStartWorld', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
pinusClient.request('battle.auctionHandler.debugScheduleStartWorld', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
checkSuccessResponse(res, false);
|
checkSuccessResponse(res, false);
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('测试接口,拍卖结束定时', function (done) {
|
it('测试接口,拍卖结束定时', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.debugScheduleStopAuction', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
pinusClient.request('battle.auctionHandler.debugScheduleStopAuction', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
checkSuccessResponse(res, false);
|
checkSuccessResponse(res, false);
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('测试接口,结算分红定时', function (done) {
|
it('测试接口,结算分红定时', function (done) {
|
||||||
pinusClient.request('battle.auctionHandler.debugScheduleSendUngotDividend', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
pinusClient.request('battle.auctionHandler.debugScheduleSendUngotDividend', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||||
checkSuccessResponse(res, false);
|
checkSuccessResponse(res, false);
|
||||||
done();
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user