Files
ZYZ/game-server/test/gift.test.ts
2023-02-18 19:38:40 +08:00

58 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
import { expect } from 'chai';
import { Client } from './Client';
import { addItem, checkSuccessResponse } from './CheckPatten';
describe('测试英杰传宝箱', function () {
let pinusClient: PinusWSClient;
let roleInfo;
const GOOD_ID_ZHUGE = 71058;
const GOOD_ID_RED_RAND = 71072;
before(function (done) {
const c = new Client();
const timer = setInterval(() => {
if (c.client) {
pinusClient = c.client;
roleInfo = c.roleInfo;
clearInterval(timer);
done();
}
}, 500);
});
after(function (done) {
pinusClient.disconnect();
// disconnect 后等待 500ms供服务器清理环境、退出频道等
setTimeout(() => {
done();
}, 500);
});
it('使用随机保底宝箱', function (done) {
addItem(pinusClient, GOOD_ID_RED_RAND, 1, (res) => {
pinusClient.request('role.itemHandler.useItem', {
id: GOOD_ID_RED_RAND,
selected: [],
count: 1
}, (res) => {
checkSuccessResponse(res);
console.log(JSON.stringify(res));
done();
});
});
});
it('查看保底情况', function (done) {
pinusClient.request('role.itemHandler.getGiftPackageFloor', {
id: GOOD_ID_RED_RAND,
}, (res) => {
checkSuccessResponse(res);
console.log(JSON.stringify(res));
done();
});
});
});