시나리오 기본 시작 연도와 출병 제한 기준 통일
This commit is contained in:
@@ -5,7 +5,12 @@ import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { composeScenarioResource } from '@sammo-ts/game-engine/scenario/scenarioComposition.js';
|
||||
import { loadScenarioDefinitionById } from '@sammo-ts/game-engine/scenario/scenarioLoader.js';
|
||||
import { parseScenarioDefaults, parseScenarioDefinition, type ScenarioDefaults } from '@sammo-ts/logic';
|
||||
import {
|
||||
resolveScenarioStartYear,
|
||||
parseScenarioDefaults,
|
||||
parseScenarioDefinition,
|
||||
type ScenarioDefaults,
|
||||
} from '@sammo-ts/logic';
|
||||
import { resolveWorkspaceRoot } from '../orchestrator/workspaceRoot.js';
|
||||
|
||||
export interface ScenarioNationPreview {
|
||||
@@ -228,7 +233,7 @@ const buildScenarioPreview = async (scenarioId: number): Promise<ScenarioPreview
|
||||
return {
|
||||
id: scenarioId,
|
||||
title: scenario.title,
|
||||
year: scenario.startYear ?? null,
|
||||
year: resolveScenarioStartYear(scenario.startYear),
|
||||
defaultStatTotal: scenario.config.stat.total,
|
||||
fiction: scenario.fiction,
|
||||
npcCount: scenario.generals.length,
|
||||
@@ -275,7 +280,7 @@ const buildScenarioPreviewFromGit = async (commitSha: string, scenarioId: number
|
||||
return {
|
||||
id: scenarioId,
|
||||
title: scenario.title,
|
||||
year: scenario.startYear ?? null,
|
||||
year: resolveScenarioStartYear(scenario.startYear),
|
||||
defaultStatTotal: scenario.config.stat.total,
|
||||
fiction: scenario.fiction,
|
||||
npcCount: scenario.generals.length,
|
||||
|
||||
@@ -3,6 +3,14 @@ import { describe, expect, it } from 'vitest';
|
||||
import { listScenarioPreviews, resolveGitCommitSha } from '../src/scenario/scenarioCatalog.js';
|
||||
|
||||
describe('scenarioCatalog git ref support', () => {
|
||||
it.each([undefined, 'HEAD'])('publishes resolved start years for every scenario (%s)', async (gitRef) => {
|
||||
const previews = await listScenarioPreviews({ gitRef });
|
||||
expect(previews.every((scenario) => Number.isFinite(scenario.year))).toBe(true);
|
||||
expect(previews.find((scenario) => scenario.id === 2020)?.year).toBe(180);
|
||||
expect(previews.find((scenario) => scenario.id === 1031)?.year).toBe(192);
|
||||
expect(previews.find((scenario) => scenario.id === 915)?.year).toBe(180);
|
||||
});
|
||||
|
||||
it('includes the CHE zero-season dawn scenario in the local catalog', async () => {
|
||||
const previews = await listScenarioPreviews();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user