const {test}=require('node:test'); const assert=require('node:assert/strict'); const {classicCommand,classicMode}=require('../.test-build/classic.js'); const actor={name:'Zaku',autonomy:{managed:true,characterGuid:7,accountId:3}}; test('Classic transport requires explicit backend selection',()=>{ assert.equal(classicMode({}),false); assert.equal(classicMode({GAME_BACKEND:'cmangos-classic'}),true); }); test('Classic command rejects absent, zero and unmanaged native identities',()=>{ for(const autonomy of [undefined,{managed:false,characterGuid:7,accountId:3},{managed:true,characterGuid:0,accountId:3},{managed:true,characterGuid:7,accountId:-1}]) assert.throws(()=>classicCommand('intent',{...actor,autonomy},'quest')); assert.throws(()=>classicCommand('party',actor)); }); test('Classic peer commands bind both accounts and preserve literal speech',()=>{ const peer={name:'Alany',autonomy:{managed:true,characterGuid:8,accountId:4}}; const message='hello "friend"; return 1'; const command=JSON.parse(classicCommand('say',actor,message,peer)); assert.equal(command.argument,message); assert.equal(command.guid,7);assert.equal(command.accountId,3); assert.equal(command.peerGuid,8);assert.equal(command.peerAccountId,4); assert.ok(command.expiresAt>Date.now()/1000); });