import assert from 'node:assert/strict'; import test from 'node:test'; import { applyAction, viewGame } from '../game/engine'; import { botActions, runBots } from '../game/bots'; import { createSaphoStationPriorityFixture } from './sapho-station-priority-fixture'; for (const advanced of [false, true]) void test( `${advanced ? 'Advanced' : 'Basic'} Station priority wins over a synthetic competing bot guide`, () => { const fixture = createSaphoStationPriorityFixture(advanced); const initial = fixture.game; const event = initial.saphoStationPriority!.event; const view = viewGame(initial, fixture.first); // A supported Station decision normally suppresses turn-action guidance. // Inject a competing projected guide to exercise defensive dispatch order; // this does not claim that the combination occurs in an ordinary game. view.turnActionGuide = {event:'synthetic-guide', action:{type:'ready'}}; const action = botActions(view)[0]; assert.deepEqual(action, {type:'saphoStationPass', event}); const afterPass = applyAction(initial, fixture.first, action); assert.deepEqual(afterPass.saphoStationPriority?.passed, [fixture.first]); assert.deepEqual(afterPass.ecologicalStorm?.queue?.choices, []); assert.equal(viewGame(afterPass, fixture.holder).saphoStationPriority?.canPass, true); // Real scheduler behavior is separately checked on the public-start state; // only the fixture's Station placement and card custody were staged. const scheduled = runBots(initial, 12); assert.deepEqual(scheduled.saphoStationPriority?.passed, [fixture.first]); assert.deepEqual(scheduled.ecologicalStorm?.queue?.choices, []); assert.equal(viewGame(scheduled, fixture.holder).saphoStationPriority?.canPass, true); }, );