Files
core2026/app/game-frontend/test/commandTargetDescription.test.ts
T
Hide_DandClaude Opus 5.5 4a50c354fe 등용·장수대상임관 대상의 타국 장수 정보를 Ref 공개 범위로 제한하고 국가색 묶음 복원
- 명령표의 등용·장수대상임관·공통 장수 fallback에서 타국·재야 장수의 금·쌀·병력·훈련·사기·부대·위치 도시를 제외
- Ref exportJSVars 범위(이름·국가·NPC·통/무/지)만 싣고 국가 묶음용 nationId 추가
- 재야 actor에게는 같은 국가 명령 후보를 보내지 않음
- 등용·장수대상임관 후보를 Ref SelectGeneral groupByNation처럼 국가색 머리와 optgroup으로 묶음
- 증여·포상·몰수·부대탈퇴지시·선양 후보에 Ref의 통/무/지 표시

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 14:55:39 +00:00

31 lines
1.5 KiB
TypeScript

import assert from 'node:assert/strict';
import { test } from 'node:test';
import { commandTargetDescription } from '../src/utils/commandTargetDescription.ts';
void test('nullable troop names receive display-only fallbacks and preserve leader and member information', () => {
const base = { value: 1, label: '관우', description: '금 100', targetNames: { name: '관우', troopName: null } };
assert.equal(commandTargetDescription('che_증여', base), '금 100 · 탑승 부대 없음');
assert.equal(commandTargetDescription('che_발령', base), '탑승 부대 없음\n금 100');
assert.equal(commandTargetDescription('che_포상', base), '금 100');
assert.equal(commandTargetDescription('che_몰수', base), '금 100');
assert.equal(commandTargetDescription('che_선양', base), '금 100');
assert.equal(commandTargetDescription('che_증여', { ...base, troopId: 99 }), '금 100 · 탑승 부대 #99');
assert.equal(
commandTargetDescription('che_증여', {
...base,
troopId: 1,
targetNames: { name: '관우', troopName: '청룡대' },
}),
'금 100 · 탑승 부대 청룡대 (부대장)'
);
assert.equal(
commandTargetDescription('che_증여', {
...base,
targetNames: undefined,
description: '금 100 · 탑승 부대 없음',
}),
'금 100 · 탑승 부대 없음'
);
assert.equal(commandTargetDescription('che_증여'), '');
});