fix reserved turn permission constraints

This commit is contained in:
2026-07-26 18:57:27 +00:00
parent 7a18bb48f2
commit d1e9d5fc75
13 changed files with 482 additions and 18 deletions
+22 -1
View File
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';
import type { CityRow, GeneralRow, NationRow, WorldStateRow } from '../src/context.js';
import { buildTurnCommandTable } from '../src/turns/commandTable.js';
const buildWorldState = (): WorldStateRow =>
const buildWorldState = (joinMode = 'full'): WorldStateRow =>
({
id: 1,
scenarioCode: 'default',
@@ -11,6 +11,7 @@ const buildWorldState = (): WorldStateRow =>
currentMonth: 1,
tickSeconds: 600,
config: {
joinMode,
const: {
baseGold: 1000,
baseRice: 1000,
@@ -115,4 +116,24 @@ describe('buildTurnCommandTable', () => {
expect(nationCommand?.possible).toBe(true);
expect(nationCommand?.status).not.toBe('blocked');
});
it('provides join_mode to reservation availability constraints', async () => {
const table = await buildTurnCommandTable({
worldState: buildWorldState('onlyRandom'),
general: buildGeneral(),
city: buildCity(),
nation: buildNation(),
nationGenerals: null,
});
const appointment = table.general
.flatMap((group) => group.values)
.find((command) => command.key === 'che_임관');
expect(appointment).toMatchObject({
possible: false,
status: 'blocked',
reason: '랜덤 임관만 가능합니다',
});
});
});