import test from 'node:test'; import assert from 'node:assert/strict'; import {GAME_DEFINITIONS} from '../fixtures/game-definitions.ts'; test('unmigrated game settlement is explicit rather than silently acknowledging deskfree',()=>{ for(const definition of Object.values(GAME_DEFINITIONS)){ const game=definition.createGame('g'),module=game.entry.createModule(); module.attach({capabilities:{room:{subscribe:()=>()=>{},getSnapshot:()=>({})}}} as any); try{assert.throws(()=>module.handlePlatformEvent({type:'room.dissolution-confirmed',freeNow:false,deskfree:{round:2}}),/解散结算.*尚未接入/);} finally{module.dispose();} } }); test('game room exit always delegates to the bound platform policy',()=>{ for(const definition of Object.values(GAME_DEFINITIONS)){ const game=definition.createGame('g'),module=game.entry.createModule(),calls:unknown[]=[]; let snapshot:any={room:{stage:1,infinite:0}},actions:any; module.attach({capabilities:{room:{subscribe:()=>()=>{},getSnapshot:()=>snapshot,requestExit:()=>calls.push('exit')}}} as any); game.mount({render:(_s,a)=>{actions=a;},close(){}}); try{actions.exit();snapshot={room:{stage:0,infinite:0}};actions.exit();snapshot={room:{stage:1,infinite:1}};actions.exit(); assert.deepEqual(calls,['exit','exit','exit']);} finally{module.dispose();} } });