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.
28 lines
1.8 KiB
JavaScript
28 lines
1.8 KiB
JavaScript
const fs=require('fs'),path=require('path'),assert=require('node:assert/strict');
|
|
const results=[];
|
|
for(const key of ['alpha','beta']){
|
|
const other=key==='alpha'?'beta':'alpha';
|
|
const root=path.join(__dirname,'project/build/probe-url-'+key);
|
|
const meta=JSON.parse(fs.readFileSync(path.join(root,'probe-build.json'),'utf8'));
|
|
assert.deepEqual(meta.bundles,['internal','main','game-'+key]);
|
|
assert(!fs.existsSync(path.join(root,'assets/game-'+other)));
|
|
const files=[];function walk(dir){for(const ent of fs.readdirSync(dir,{withFileTypes:true})){const file=path.join(dir,ent.name);if(ent.isDirectory())walk(file);else files.push(file);}}walk(root);
|
|
const code=files.filter(f=>/\.(js|json|txt)$/.test(f)).map(f=>fs.readFileSync(f,'utf8')).join('\n');
|
|
assert(code.includes('PRIVATE_CODE_'+key.toUpperCase()));
|
|
assert(code.includes('PRIVATE_RESOURCE_'+key.toUpperCase()));
|
|
assert(!code.includes('PRIVATE_CODE_'+other.toUpperCase()));
|
|
assert(!code.includes('PRIVATE_RESOURCE_'+other.toUpperCase()));
|
|
const runtime=JSON.parse(fs.readFileSync(path.join(__dirname,'runtime-'+key+'.json'),'utf8'));
|
|
assert.equal(runtime.report.ok,true);
|
|
assert.equal(runtime.report.selected,'game-'+key);
|
|
assert.equal(runtime.report.code,'PRIVATE_CODE_'+key.toUpperCase());
|
|
assert.equal(runtime.report.text,'PRIVATE_RESOURCE_'+key.toUpperCase());
|
|
assert.equal(runtime.report.prefab,'View');
|
|
assert.equal(runtime.report.otherRegistered,false);
|
|
assert(runtime.requests.some(r=>r.url.includes('/assets/game-'+key+'/index.js')));
|
|
assert(runtime.requests.every(r=>r.status===200&&!r.url.includes('/assets/game-'+other+'/')));
|
|
results.push({game:key,bundles:meta.bundles,files:files.length,requests:runtime.requests.length,passed:true});
|
|
}
|
|
fs.writeFileSync(path.join(__dirname,'verification.json'),JSON.stringify(results,null,2));
|
|
console.log(JSON.stringify(results,null,2));
|