import test from 'node:test'; import assert from 'node:assert/strict'; import { createRemoteConfig } from '../../YouleNexus/assets/framework/config/remote-config.ts'; import { resolveLobbyPolicy, shouldShowNotice, selectLobbyModel } from '../../YouleNexus/assets/framework/presentation/lobby-model.ts'; const identity = {agentid:'a',gameid:'g',channelid:'c',marketid:'m',version:1}; test('announcement interval preserves strict expiry and never shows on reconnect',()=>{ assert.equal(shouldShowNotice(0, null, 1000, false),true); assert.equal(shouldShowNotice(-1, null, 1000, false),false); assert.equal(shouldShowNotice(1, 1000, 3601000, false),false); assert.equal(shouldShowNotice(1, 1000, 3601001, false),true); assert.equal(shouldShowNotice(0, null, 1000, true),false); }); test('notice configuration follows the same channel source and replaces legacy line breaks',()=>{ const p=resolveLobbyPolicy(createRemoteConfig({noticemsg:'global',agentlist:[{agentid:'a',menunotice:{advert0:{type:0,msg:'one#two',url:''}}}]},identity)); assert.equal(p.notices[0].text,'one\ntwo'); assert.equal(p.noticeHours,0); assert.throws(()=>resolveLobbyPolicy(createRemoteConfig({gameNoticeShow:'bad'},identity)),/gameNoticeShow/); }); test('lobby rejects incomplete self assets instead of displaying invented zeroes',()=>{ assert.throws(()=>selectLobbyModel({app:{phase:'logged-in'},room:{kind:'outside'},players:{selfPlayerId:7,entities:{7:{playerid:7,nickname:'A',avatar:'',sex:0,bean:0}}}}),/roomcard/); });