Files
youle_cocos/cocoscreator_projects/framework-tests/presentation/dissolution-settlement-boundary.test.ts
T
joywayer 35216f75e7 feat: integrate room framework and isolated subgame bundles
Complete room UI and protocol integration, move game definitions and resources behind bundle entries, publish authoritative version XML, and document single-game builds. Include all current resource changes and experiment artifacts.
2026-09-09 03:13:18 +08:00

24 lines
1.3 KiB
TypeScript

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();}
}
});