Add optional short alliance victory
Verify and publish checkpoint container / container (push) Successful in 11m2s

This commit is contained in:
Quintine committed 2026-10-28 21:40:24 +11:00
1 parent 8fb9f59106
commit e896570f07
25 files changed
+632 -27

No files matched your search

+16 -2
View File
@@ -1,11 +1,11 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { adminLobbyConfirmation, adminLobbyResponse, clearAdminLobbyRequest, newAdminLobbyRequest, readAdminLobbyRequest, saveAdminLobbyRequest } from '../lib/admin-lobby-client';
import { adminLobbyConfirmation, adminLobbyResponse, clearAdminLobbyRequest, describeAdminLobbyAction, newAdminLobbyRequest, readAdminLobbyRequest, saveAdminLobbyRequest } from '../lib/admin-lobby-client';
import type { AdminLobbyView } from '../lib/admin-lobby-configuration';
import { DEFAULT_ROOM_CONTROL } from '../lib/room-control';
const view = (): AdminLobbyView => ({ code: 'ABCD2345', version: 4, status: 'lobby', editable: true, blockedReason: null, host: 'host',
advanced: false, techTokens: false, strongholdCards: false, control: { ...DEFAULT_ROOM_CONTROL },
advanced: false, techTokens: false, strongholdCards: false, shortAllianceVictory: false, control: { ...DEFAULT_ROOM_CONTROL },
players: [{ id: 'host', name: 'Host', faction: 'atreides', bot: null, position: 1, ready: false, hostEligible: true }] });
function storage() {
const values = new Map<string, string>();
@@ -59,3 +59,17 @@ void test('lobby response accepts unreadable room diagnostics but rejects privat
{ ...lobby, control: { ...lobby.control, reason: 'Private audit' } }, { ...lobby, players: [{ ...lobby.players[0], position: 7 }] }])
assert.throws(() => adminLobbyResponse(invalid, lobby.code));
});
void test('short alliance selection survives the same validated retry and confirmation path', () => {
const current = view(), tab = storage();
const action = { type: 'shortAllianceVictory' as const, enabled: true };
const input = newAdminLobbyRequest(current, action, 'Use shorter alliance game');
assert.match(describeAdminLobbyAction(action, current), /Enable.*three-stronghold alliance victory/);
saveAdminLobbyRequest(tab, 'a', current.code, input);
assert.deepEqual(readAdminLobbyRequest(tab, 'a', current.code), input);
const updated = { ...current, version: 5, shortAllianceVictory: true };
assert.equal(adminLobbyResponse(updated, current.code).shortAllianceVictory, true);
assert.equal(adminLobbyConfirmation({ operationId: input.operationId, replayed: false, appliedVersion: 5, lobby: updated }, current.code, input).lobby.shortAllianceVictory, true);
assert.throws(() => adminLobbyResponse({ ...updated, shortAllianceVictory: 'true' }, current.code));
assert.throws(() => newAdminLobbyRequest(current, { ...action, enabled: 'true' } as unknown as typeof action, 'QA'));
});