const {test}=require('node:test'); const assert=require('node:assert/strict'); const {compileAleOperatorRequest,wrapAleCommand,ALE_SURFACE}=require('../.test-build/ale.js'); test('ALE command lane compiles server commands without raw execution',()=>{ const source=compileAleOperatorRequest({kind:'command',command:'server info'},false); assert.match(source,/RunCommand/); assert.match(source,/server info/); }); test('ALE typed calls compile global player and playerbot AI methods',()=>{ assert.match(compileAleOperatorRequest({kind:'global',method:'SendWorldMessage',args:['Hello']},false),/SendWorldMessage/); assert.match(compileAleOperatorRequest({kind:'player',player:'Zaku',method:'GetHealth'},false),/GetPlayerByName/); assert.match(compileAleOperatorRequest({kind:'playerbotAI',player:'Zaku',method:'DoSpecificAction',args:['follow']},false),/GetBotAI/); }); test('ALE method names are identifier-only',()=>{ assert.throws(()=>compileAleOperatorRequest({kind:'global',method:'RunCommand); os.execute("x") --'},false),/Invalid ALE method name/); }); test('raw ALE execution is disabled unless explicitly enabled',()=>{ assert.throws(()=>compileAleOperatorRequest({kind:'raw',source:'return GetPlayerCount()'},false),/disabled/); assert.equal(compileAleOperatorRequest({kind:'raw',source:'return GetPlayerCount()'},true),'return GetPlayerCount()'); }); test('wrapped ALE command reports completion through the bridge callback',()=>{ const source=wrapAleCommand('11111111-1111-4111-8111-111111111111','return 7'); assert.match(source,/AzerothAIComplete/); assert.match(source,/return 7/); }); test('surface inventory includes every documented ALE class family',()=>{ assert.equal(ALE_SURFACE.gameClasses.length,30); assert.equal(ALE_SURFACE.playerbotClasses.length,7); assert.equal(ALE_SURFACE.modelAccess,'none'); });