🧪 test(测试): 添加军团抽卡概率测试
This commit is contained in:
@@ -5,6 +5,73 @@ import { expect } from 'chai';
|
||||
import { checkSuccessResponse, checkDisplayItems, checkHero, addItem } from './CheckPatten';
|
||||
import { GACHA_TYPE } from '../../shared/consts';
|
||||
|
||||
describe.skip('抽卡概率测试', function () {
|
||||
let pinusClient: PinusWSClient;
|
||||
let roleInfo;
|
||||
let arr: number[] = [];
|
||||
|
||||
|
||||
before(function (done) {
|
||||
const c = new Client();
|
||||
const timer = setInterval(() => {
|
||||
if (c.client) {
|
||||
pinusClient = c.client;
|
||||
roleInfo = c.roleInfo;
|
||||
clearInterval(timer);
|
||||
done();
|
||||
}
|
||||
for(let i = 0; i < 10000; i++) arr.push(i)
|
||||
}, 500);
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
// pinusClient.disconnect();
|
||||
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||
setTimeout(() => {
|
||||
done();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it('抽卡准备', function (done) {
|
||||
pinusClient.request('role.heroHandler.addItem', { id: 22003, count: 100000000 }, (res) => {
|
||||
pinusClient.request('activity.gachaHandler.setPickHero', { gachaId: 8, activityId: 182, pickHero: 66 }, (res) => {
|
||||
done()
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it(`dummy`, function(done) {
|
||||
describe('500抽', function() {
|
||||
arr.forEach(function(d, index) {
|
||||
it(`500抽 ${index}`, function(_done) {
|
||||
pinusClient.request('activity.gachaHandler.pull', { gachaId: 8, activityId: 182, count: 500 }, (res) => {
|
||||
let map = new Map();
|
||||
for(let h of res.data.result) {
|
||||
if(h.id == 21066) {
|
||||
let arr = map.get('planId')||[];
|
||||
let obj = arr.find(cur => cur.planId == h.planId);
|
||||
obj? obj.count ++: arr.push({planId: h.planId, count: 1});
|
||||
map.set('planId', arr);
|
||||
|
||||
if(!map.has('count')) map.set('count', 0);
|
||||
map.set('count', map.get('count') + h.count);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(index, map.get('planId').sort((a,b) => a.planId - b.planId).map(cur => `${cur.planId}&${cur.count}`).join('|'), map.get('count'));
|
||||
|
||||
_done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it(`result`, function(done) {
|
||||
done();
|
||||
})
|
||||
done();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('抽卡测试', function () {
|
||||
let pinusClient: PinusWSClient;
|
||||
|
||||
Reference in New Issue
Block a user