빙의 군주의 외교권자 임명 권한을 복구

This commit is contained in:
2026-09-23 04:35:44 +00:00
parent 99a831b251
commit 7e9cde3592
5 changed files with 38 additions and 4 deletions
@@ -52,6 +52,7 @@ const buildGeneral = (id: number, overrides: Partial<TurnGeneral> = {}): TurnGen
const buildWorld = (options: {
generals?: TurnGeneral[];
nationMeta?: Record<string, TriggerValue>;
nationChiefGeneralId?: number | null;
cityMeta?: Record<string, TriggerValue>;
currentYear?: number;
scenarioConst?: Record<string, unknown>;
@@ -106,7 +107,7 @@ const buildWorld = (options: {
name: '위',
color: '#777777',
capitalCityId: 1,
chiefGeneralId: 1,
chiefGeneralId: options.nationChiefGeneralId === undefined ? 1 : options.nationChiefGeneralId,
gold: 10_000,
rice: 20_000,
power: 0,
@@ -321,6 +322,26 @@ describe('nation personnel world commands', () => {
expect(fixture.world.getGeneralById(3)?.meta.permission).toBe('normal');
});
it('allows a possessed ruler to appoint an ambassador when a seeded nation has no chief pointer', async () => {
const fixture = buildWorld({
nationChiefGeneralId: null,
generals: [
buildGeneral(1, { officerLevel: 12, npcState: 1 }),
buildGeneral(2, { npcState: 2 }),
],
});
await expect(
fixture.handler.handle({
type: 'changePermission',
userId: 'user-1',
generalId: 1,
isAmbassador: true,
targetGeneralIds: [2],
})
).resolves.toMatchObject({ ok: true });
expect(fixture.world.getGeneralById(2)?.meta.permission).toBe('ambassador');
});
it('kicks for an unlocked head officer with resource, troop, permission, and log side effects', async () => {
const target = buildGeneral(3, {
troopId: 3,