merge: 최신 main을 토너먼트 즉시 조편성 수정에 통합

This commit is contained in:
2026-08-17 10:49:24 +00:00
21 changed files with 455 additions and 118 deletions
+23 -2
View File
@@ -117,7 +117,7 @@ const buildBattleRequest = () => ({
conflict: '{}',
},
attackerNation: {
type: 'test',
type: 'che_도적',
tech: 1000,
level: 1,
capital: 1,
@@ -193,7 +193,7 @@ const buildBattleRequest = () => ({
conflict: '{}',
},
defenderNation: {
type: 'test',
type: 'che_도적',
tech: 1000,
level: 1,
capital: 2,
@@ -309,6 +309,27 @@ describe('battle router orchestration', () => {
expect(battleSim.simulateCalls).toBe(0);
});
it('rejects the neutral storage nation type before preparing or queuing a simulation', async () => {
const battleSim = new QueuedBattleSimTransport();
const state: WorldStateRow = {
id: 1,
scenarioCode: 'default',
currentYear: 200,
currentMonth: 1,
tickSeconds: 600,
config: {},
meta: {},
updatedAt: new Date('2026-01-01T00:00:00Z'),
};
const caller = appRouter.createCaller(buildContext({ state, battleSim }));
const request = buildBattleRequest();
request.attackerNation.type = 'che_중립';
await expect(caller.battle.prepareSimulation(request)).rejects.toMatchObject({ code: 'BAD_REQUEST' });
await expect(caller.battle.simulate(request)).rejects.toMatchObject({ code: 'BAD_REQUEST' });
expect(battleSim.simulateCalls).toBe(0);
});
it('returns queued then completed results via transport', async () => {
const battleSim = new QueuedBattleSimTransport();
const state: WorldStateRow = {
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest';
import { AVAILABLE_NATION_TRAIT_KEYS } from '@sammo-ts/logic';
import { loadBattleSimTraitOptions } from '../src/battleSim/simulatorOptions.js';
describe('selectable trait options', () => {
it('uses the Ref available nation-type list for founding and battle simulation inputs', async () => {
const options = await loadBattleSimTraitOptions();
expect(options.nationTypes.map((entry) => entry.key)).toEqual(AVAILABLE_NATION_TRAIT_KEYS);
expect(options.nationTypes).not.toEqual(
expect.arrayContaining([expect.objectContaining({ key: 'che_중립' })])
);
});
});