Modes: deflake restart test (opening hand may have no turn-1 play)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 00:27:49 -05:00
co-authored by Claude Opus 5.5
parent e2798a7ddc
commit 0d2f94c1bf
+3 -2
View File
@@ -225,8 +225,9 @@ test('modes api: live matches survive a node restart (snapshot on shutdown, rest
persistLive(first, dir, false); persistLive(first, dir, false);
const a = first.createLobby('classic', alice); const a = first.createLobby('classic', alice);
const b = await first.join(a.lobbyId, bob); const b = await first.join(a.lobbyId, bob);
const play = (first.view(a.lobbyId, a.token) as any).legalActions.find((x: any) => x.type === 'play'); // Random seed: the opening hand may have nothing playable on turn 1, so fall back to commit.
await first.act(a.lobbyId, a.token, play); const legal = (first.view(a.lobbyId, a.token) as any).legalActions;
await first.act(a.lobbyId, a.token, legal.find((x: any) => x.type === 'play') ?? legal.find((x: any) => x.type === 'commit'));
const d = first.createLobby('draft', alice); const d = first.createLobby('draft', alice);
const e = await first.join(d.lobbyId, bob); const e = await first.join(d.lobbyId, bob);
const pick = (first.view(d.lobbyId, d.token) as any).draft; const pick = (first.view(d.lobbyId, d.token) as any).draft;