mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-17 14:21:25 +02:00
A browser-based roguelike synchronized with crypto block timing. A run is a race against the next block: reach the exit before the block lands, or the house wins. The same codebase runs the solo dungeon, the social Tavern, and operator-selected PvP and race rulesets, with separate free and paid leaderboards. Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md for the design, and docs/DEPLOY.md to operate an instance.
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
const PaymentConfigManager = require('../src/config/paymentConfig');
|
|
const GameModeManager = require('../src/game/gameModeManager');
|
|
|
|
describe('PaymentConfigManager atomic-unit precision', () => {
|
|
const originalPrice = process.env.DIRECT_GAME_PRICE;
|
|
|
|
afterEach(() => {
|
|
if (originalPrice === undefined) delete process.env.DIRECT_GAME_PRICE;
|
|
else process.env.DIRECT_GAME_PRICE = originalPrice;
|
|
});
|
|
|
|
test('parses integer environment values above Number.MAX_SAFE_INTEGER exactly', () => {
|
|
process.env.DIRECT_GAME_PRICE = '100000000000000001';
|
|
|
|
const config = new PaymentConfigManager({
|
|
logger: { warn: jest.fn(), info: jest.fn(), error: jest.fn() }
|
|
}).getConfig();
|
|
|
|
expect(config.modes.direct.price).toBe(100000000000000001n);
|
|
});
|
|
|
|
test('game mode snapshot and public transport preserve large atomic prices exactly', () => {
|
|
process.env.DIRECT_GAME_PRICE = '100000000000000001';
|
|
const manager = new PaymentConfigManager({
|
|
logger: { warn: jest.fn(), info: jest.fn(), error: jest.fn() }
|
|
});
|
|
const gmm = new GameModeManager(
|
|
{ query: jest.fn() },
|
|
{},
|
|
{ CONSOLE_LOGGING: false },
|
|
manager
|
|
);
|
|
|
|
expect(gmm.singleGamePrice).toBe('100000000000000001');
|
|
expect(gmm.getGameModeInfo().singleGamePrice).toBe('100000000000000001');
|
|
expect(gmm.calculatePayout('PAID_SINGLE').amount).toBe('200000000000000002');
|
|
});
|
|
});
|