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.
20 lines
865 B
JavaScript
20 lines
865 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
describe('match client durable finish and fairness messaging', () => {
|
|
const source = fs.readFileSync(path.join(__dirname, '../html/js/matchClient.js'), 'utf8');
|
|
|
|
test('does not treat a settlement-pending event as a final result', () => {
|
|
const pending = source.match(/socket\.on\('match_settlement_pending',[\s\S]*?\n \}\);/);
|
|
expect(pending).toBeTruthy();
|
|
expect(pending[0]).toContain('not final yet');
|
|
expect(pending[0]).not.toContain('inRace = false');
|
|
});
|
|
|
|
test('checks the revealed seed against the published SHA-256 commitment', () => {
|
|
expect(source).toContain("subtle.digest('SHA-256'");
|
|
expect(source).toContain("actual === String(fairness.seedHash).toLowerCase()");
|
|
expect(source).toContain('seed proof ✓');
|
|
});
|
|
});
|