Files
wownerogue/test/financialAuditContract.test.js
jwinterm fad2a695bd Wownerogue
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.
2026-07-27 08:23:01 -04:00

29 lines
1.3 KiB
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const deploy = name => fs.readFileSync(path.join(__dirname, '..', 'scripts', 'deploy', name), 'utf8');
describe('deployment financial-audit contract', () => {
const audit = deploy('financial-audit.sql');
test('retained consumed match anchors are not treated as live escrow', () => {
expect(audit).toMatch(/match_queue_entries\s+WHERE status IS NULL OR status NOT IN \('consumed', 'cancelled'\)/);
expect(audit).not.toMatch(/status NOT IN \('cancelled'\)/);
});
test('nullable or unknown money/game states and a stale schema ledger fail closed', () => {
expect(audit).toContain("payouts WHERE status IS DISTINCT FROM 'completed'");
expect(audit).toMatch(/FROM payouts\s+WHERE status IS DISTINCT FROM 'completed'/);
expect(audit).not.toMatch(
/FROM payouts\s+WHERE status IS NULL OR status NOT IN \('recorded', 'completed'\)/
);
expect(audit).toContain("games WHERE status IS NULL OR status NOT IN ('won', 'lost', 'expired')");
expect(audit).toContain("MAX(filename) = '043_durable_solo_restart_snapshots.sql'");
expect(audit.match(/status IS NULL OR status NOT IN \('recorded', 'completed'\)/g))
.toHaveLength(2);
expect(audit).toContain('COUNT(*) = 43');
});
});