Import verified AzerothAI snapshot from GitHub
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
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
Source branch: feature/ai-brain-router Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
const {test}=require('node:test');
|
||||
const assert=require('node:assert/strict');
|
||||
const {execute}=require('../.test-build/service.js');
|
||||
const {seed}=require('../.test-build/seed.js');
|
||||
const {connectors}=require('../.test-build/connectors/index.js');
|
||||
|
||||
class Store {
|
||||
constructor(){this.state=seed();}
|
||||
async load(){return structuredClone(this.state);}
|
||||
async save(s,r){assert.equal(this.state.revision,r);s.revision=r+1;this.state=structuredClone(s);}
|
||||
}
|
||||
|
||||
test('Zaku is a mortal persistent hero and hardcore starts enabled',()=>{
|
||||
const state=seed();
|
||||
const zaku=state.bots.find(b=>b.id==='hero-zaku');
|
||||
assert.ok(zaku);
|
||||
assert.equal(zaku.tier,'hero');
|
||||
assert.equal(zaku.mortal,true);
|
||||
assert.equal(zaku.role,'Warlock');
|
||||
assert.equal(zaku.race,'Undead');
|
||||
assert.equal(state.settings.hardcore.enabled,true);
|
||||
assert.equal(state.settings.hardcore.requireVerifiedDeath,true);
|
||||
});
|
||||
|
||||
test('confirmed hardcore death permanently closes an identity',async()=>{
|
||||
const store=new Store();
|
||||
await execute(store,{type:'recordDeath',botId:'bot-6',cause:'Killed in combat',killer:'Defias Pillager',zone:'Westfall',confirmed:true});
|
||||
const bot=store.state.bots.find(b=>b.id==='bot-6');
|
||||
assert.equal(bot.status,'dead');
|
||||
assert.equal(bot.death.verified,true);
|
||||
assert.equal(store.state.events.at(-1).kind,'death');
|
||||
await assert.rejects(execute(store,{type:'lifecycle',botId:'bot-6',action:'spawn'}),/permanently dead/);
|
||||
});
|
||||
|
||||
test('verified bridge death ends life before another AI decision',async()=>{
|
||||
const store=new Store();
|
||||
const old=connectors.simulation;
|
||||
connectors.simulation=()=>({
|
||||
health:async()=>({ok:true,detail:'test'}),
|
||||
lifecycle:async()=>{},
|
||||
decide:async()=>{throw new Error('intent should not execute after death')},
|
||||
observe:async()=>({zone:'Duskwood',level:20,summary:'fatal combat',availableActions:['quest'],alive:false,death:{id:'death-1',at:new Date().toISOString(),cause:'Killed in combat',killer:'Stitches',zone:'Duskwood',verified:true}})
|
||||
});
|
||||
try{
|
||||
await execute(store,{type:'think',botId:'bot-1'});
|
||||
const bot=store.state.bots.find(b=>b.id==='bot-1');
|
||||
assert.equal(bot.status,'dead');
|
||||
assert.equal(bot.decisions,0);
|
||||
assert.equal(bot.death.id,'death-1');
|
||||
}finally{connectors.simulation=old;}
|
||||
});
|
||||
|
||||
test('unverified bridge death fails safe without erasing identity',async()=>{
|
||||
const store=new Store();
|
||||
const old=connectors.simulation;
|
||||
connectors.simulation=()=>({
|
||||
health:async()=>({ok:true,detail:'test'}),
|
||||
lifecycle:async()=>{},
|
||||
decide:async()=>({summary:'unused'}),
|
||||
observe:async()=>({zone:'Duskwood',level:20,summary:'ambiguous state',availableActions:['quest'],alive:false})
|
||||
});
|
||||
try{
|
||||
await assert.rejects(execute(store,{type:'think',botId:'bot-1'}),/verified death event/);
|
||||
const bot=store.state.bots.find(b=>b.id==='bot-1');
|
||||
assert.equal(bot.status,'online');
|
||||
assert.equal(bot.death,undefined);
|
||||
}finally{connectors.simulation=old;}
|
||||
});
|
||||
Reference in New Issue
Block a user