Files
youle_cocos/cocoscreator_projects/framework-tests/architecture/game-definitions.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

22 lines
1.1 KiB
TypeScript

import {test} from 'node:test';
import assert from 'node:assert/strict';
import {GAME_DEFINITIONS,getGameDefinition} from '../fixtures/game-definitions.ts';
test('each registration binds its own route, rules, presentation and chat',()=>{
for(const definition of Object.values(GAME_DEFINITIONS)){
assert.equal(getGameDefinition(definition.key),definition);
const binding=definition.createGame('configured-game-id');
assert.equal(binding.entry.key,definition.key);
assert.equal(binding.entry.route,definition.route);
assert.equal(binding.entry.gameId,'configured-game-id');
}
const eqw=GAME_DEFINITIONS.erqiwang;
assert.equal(eqw.createPageClass,'ErqiwangCreateRoomView');
assert.equal(eqw.roomViewClass,'ErqiwangRoomView');
assert.equal(eqw.chat.phrases[0].text,'快点吧,我等的花儿都谢了。');
assert.throws(()=>eqw.createGame('id').entry.resolveSeatCount([1,4,1,2]),/二七王/);
assert.equal(GAME_DEFINITIONS.Game_Surface_3.createPageClass,'TemplateCreateRoomView');
assert.equal(GAME_DEFINITIONS.Game_Surface_3.chat.phrases[0].text,'你好');
assert.throws(()=>getGameDefinition('missing'),/Unknown game/);
});