Settle multiple immediate deal payments
Verify and publish checkpoint container / container (push) Successful in 10m59s

This commit is contained in:
Quintine committed 2026-11-16 14:44:06 +11:00
1 parent cacc88906c
commit b03efd2371
11 files changed
+652 -18

No files matched your search

+10 -5
View File
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import type { DatabaseSync } from 'node:sqlite';
import test from 'node:test';
import { applyAction, viewGame, type Game } from '../game/engine';
import { applyAction, synchronizeAuctionClock, viewGame, type Game } from '../game/engine';
import type * as Rooms from '../db/rooms';
import { unitStore } from './fixture-nexus-room-store';
import {
@@ -87,6 +87,11 @@ async function fixture(
allow: true,
});
assert.equal(game.decision?.kind, 'bureaucratPayment');
// Store the same paused native clock that an authenticated room read would
// initialize; the fixture is testing the payment continuation, not migration
// from an unclocked staged auction.
game = synchronizeAuctionClock(game, clock.now(), '0:0');
assert.equal(game.decision?.kind, 'bureaucratPayment');
game.version = 41;
const code = game.code,
event = game.decision!.event!;
@@ -126,8 +131,8 @@ async function views(f: Awaited<ReturnType<typeof fixture>>, game: Game) {
room = f.restart();
for (const player of game.players) {
const auth = await room.authenticate(f.code, f.tokens[player.id]);
const view = await room.readSeatView(f.code, auth);
assert.deepEqual(view, viewGame(game, player.id));
const view = await room.readSeatView(f.code, auth, clock);
assert.deepEqual(view, viewGame(game, player.id, clock.now()));
assert.equal('bureaucratPayments' in view, false);
assert.equal('bureaucratUseEvents' in view, false);
for (const rival of view.players.filter((p) => p.id !== player.id)) {
@@ -341,10 +346,10 @@ void test('saved normal, Richese cache and Black Market payments resume card cus
assert.ok(!JSON.stringify(viewGame(after, 'g')).includes(purchased));
const saved = rows(f.sqlite);
await assert.rejects(
f.restart().act(f.code, f.auths.b, 41, action),
f.restart().act(f.code, f.auths.b, 41, action, clock),
/table changed/,
);
await assert.rejects(f.restart().act(f.code, f.auths.b, 42, action));
await assert.rejects(f.restart().act(f.code, f.auths.b, 42, action, clock));
assert.deepEqual(rows(f.sqlite), saved);
assert.deepEqual(
f.writes.map((write) => write.changes),