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.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import {test} from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {shouldShowOwnerNotice} from '../../YouleNexus/assets/framework/presentation/room-owner-notice.ts';
|
||||
|
||||
test('owner notice writes game-agent scoped expiry once per 24 hours including exact boundary',()=>{
|
||||
const values=new Map<string,string>();let writes=0;
|
||||
const storage={getItem:(key:string)=>values.get(key)??null,setItem:(key:string,value:string)=>{writes++;values.set(key,value);}};
|
||||
const now=1000,day=24*60*60*1000;
|
||||
assert.equal(shouldShowOwnerNotice(storage,'12','34',now),true);
|
||||
assert.equal(values.get('tsgame_ownerNoteTime_1234'),String(now+day));
|
||||
assert.equal(shouldShowOwnerNotice(storage,'12','34',now+day-1),false);
|
||||
assert.equal(writes,1);
|
||||
assert.equal(shouldShowOwnerNotice(storage,'12','34',now+day),true);
|
||||
assert.equal(values.get('tsgame_ownerNoteTime_1234'),String(now+2*day));
|
||||
assert.equal(shouldShowOwnerNotice(storage,'12','35',now),true);
|
||||
});
|
||||
test('owner notice treats missing, empty and zero expiry as due but exposes corrupt storage',()=>{
|
||||
for(const value of [null,'','0']){
|
||||
let saved='';assert.equal(shouldShowOwnerNotice({getItem:()=>value,setItem:(_key,value)=>{saved=value;}},'1','2',10),true);
|
||||
assert.equal(saved,'86400010');
|
||||
}
|
||||
for(const value of ['abc','NaN','Infinity','-1','1x',' ','1.5']){
|
||||
assert.throws(()=>shouldShowOwnerNotice({getItem:()=>value,setItem:()=>assert.fail('must not overwrite corrupt source')},'1','2',10),/expiry/);
|
||||
}
|
||||
assert.throws(()=>shouldShowOwnerNotice({getItem:()=>null,setItem:()=>{}},'1','2',NaN),/now/);
|
||||
});
|
||||
Reference in New Issue
Block a user