Files
AzerothAI/tests/ale.test.cjs
T
Richard Clark 5f0fc86cf9
Core tests / core (push) Successful in 9m57s
Full verification / application (push) Failing after 5m16s
Full verification / local-brain (push) Failing after 6m15s
Realm simulation / simulated-live-world (push) Failing after 5m32s
WoW integration lab / real-worldserver (push) Canceled after 17m23s
Import verified AzerothAI snapshot from GitHub
Source branch: feature/ai-brain-router
Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
2026-09-22 13:12:54 -04:00

37 lines
1.8 KiB
JavaScript

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');
});