From 044c916990e659731b9a9c8e91a863c6c5cd980c Mon Sep 17 00:00:00 2001 From: hided62 Date: Fri, 7 Aug 2026 10:23:16 +0000 Subject: [PATCH] test: restore validation baseline --- .../test/monthlyCreateManyNpcAction.test.ts | 1 + .../test/npcNationUprisingUnification.test.ts | 23 +++++++++++++++++-- .../e2e/commandArguments.spec.ts | 4 ++-- app/game-frontend/src/views/BettingView.vue | 3 ++- app/gateway-api/src/account/router.ts | 21 +++++++---------- .../logic/test/scenarios/blankStart.test.ts | 8 +++---- .../scenarios/reservedTurnExecution.test.ts | 6 ++--- .../test/auctionFlow.test.ts | 1 + .../test/initialization.test.ts | 1 + .../test/orchestrator.e2e.test.ts | 1 + .../test/tournamentLifecycle.test.ts | 1 + 11 files changed, 45 insertions(+), 25 deletions(-) diff --git a/app/game-engine/test/monthlyCreateManyNpcAction.test.ts b/app/game-engine/test/monthlyCreateManyNpcAction.test.ts index 12f92f4..83b6c05 100644 --- a/app/game-engine/test/monthlyCreateManyNpcAction.test.ts +++ b/app/game-engine/test/monthlyCreateManyNpcAction.test.ts @@ -178,6 +178,7 @@ describe('CreateManyNPC monthly action', () => { "dex4": 0, "dex5": 0, "killturn": 323, + "legacyScanOrder": 1, "npcType": 3, "npc_org": 3, "specage": 27, diff --git a/app/game-engine/test/npcNationUprisingUnification.test.ts b/app/game-engine/test/npcNationUprisingUnification.test.ts index a443fe4..93e1a8b 100644 --- a/app/game-engine/test/npcNationUprisingUnification.test.ts +++ b/app/game-engine/test/npcNationUprisingUnification.test.ts @@ -417,10 +417,17 @@ describe('NPC 건국/통일 장기 시뮬레이션', () => { undefined, observeProfileMonth ); - memoryProfiler?.sample('all-cities-occupied'); - + await runUntil( + (current) => + world.listCities().every((city) => city.nationId > 0) || + current.currentYear > 184 || + (current.currentYear === 184 && current.currentMonth >= 6), + undefined, + observeProfileMonth + ); const neutralCities = world.listCities().filter((city) => city.nationId <= 0); expect(neutralCities.length).toBe(0); + memoryProfiler?.sample('all-cities-occupied'); const hasHighOfficer = world .listGenerals() @@ -569,6 +576,18 @@ describe('NPC 건국/통일 장기 시뮬레이션', () => { prevNationCount = activeNationCount; if (activeNationCount === 1 && !unifiedAt) { + const currentState = world.getState(); + const currentMeta = currentState.meta as Record; + // The processor intentionally stops calendar advancement after unification. + // Waiting for another month from this state would rerun due generals forever. + if ((currentMeta.isUnited ?? currentMeta.isunited ?? 0) !== 0) { + unifiedAt = { + year: currentState.currentYear, + month: currentState.currentMonth, + }; + memoryProfiler?.sample('unified'); + break; + } const nextMonth = addMonths(world.getState().currentYear, world.getState().currentMonth, 1); await runUntil( (current) => diff --git a/app/game-frontend/e2e/commandArguments.spec.ts b/app/game-frontend/e2e/commandArguments.spec.ts index a5cc8f8..db860ef 100644 --- a/app/game-frontend/e2e/commandArguments.spec.ts +++ b/app/game-frontend/e2e/commandArguments.spec.ts @@ -130,8 +130,8 @@ const chiefCenter = { const install = async (page: Page, rejectGeneral = false) => { const requests: unknown[] = []; - let generalTurns = turns(30); - let nationTurns = turns(12); + const generalTurns = turns(30); + const nationTurns = turns(12); let generalRevision = 0; let nationRevision = 0; await page.addInitScript((profile) => { diff --git a/app/game-frontend/src/views/BettingView.vue b/app/game-frontend/src/views/BettingView.vue index e86e4cf..a621344 100644 --- a/app/game-frontend/src/views/BettingView.vue +++ b/app/game-frontend/src/views/BettingView.vue @@ -62,6 +62,7 @@ const candidates = computed(() => ); const totalAmount = computed(() => summary.value?.totalAmount ?? 0); const myAmount = computed(() => summary.value?.myAmount ?? 0); +const betTotals = computed(() => summary.value?.totals as Record | undefined); const ratio = (id: number) => { const totals = summary.value?.totals as Record | undefined; const amount = totals?.[id] ?? 0; @@ -125,7 +126,7 @@ const placeBet = async (targetId: number) => { :participants="snapshot?.participants ?? []" :matches="snapshot?.matches ?? []" :winner-id="snapshot?.state?.winnerId" - :bet-totals="summary?.totals as Record | undefined" + :bet-totals="betTotals" :total-bet="totalAmount" :show-legend="false" force-desktop diff --git a/app/gateway-api/src/account/router.ts b/app/gateway-api/src/account/router.ts index e82e8b6..21cab89 100644 --- a/app/gateway-api/src/account/router.ts +++ b/app/gateway-api/src/account/router.ts @@ -231,19 +231,14 @@ export const accountRouter = router({ contentType: ICON_CONTENT_TYPES[extension]!, body: buffer, }); - let stored; - try { - stored = await ctx.users.addIconForWindow( - user.id, - uploaded.picture, - 0, - now, - new Date(now.getTime() - ICON_UPLOAD_COOLDOWN_MS), - MAX_ACTIVE_ICONS - ); - } catch (error) { - throw error; - } + const stored = await ctx.users.addIconForWindow( + user.id, + uploaded.picture, + 0, + now, + new Date(now.getTime() - ICON_UPLOAD_COOLDOWN_MS), + MAX_ACTIVE_ICONS + ); if (!stored.ok) { if (stored.reason === 'LIMIT') { throw new TRPCError({ diff --git a/packages/logic/test/scenarios/blankStart.test.ts b/packages/logic/test/scenarios/blankStart.test.ts index 92128b9..8b9a88e 100644 --- a/packages/logic/test/scenarios/blankStart.test.ts +++ b/packages/logic/test/scenarios/blankStart.test.ts @@ -166,8 +166,8 @@ describe('Blank Start Scenario', () => { const world = new InMemoryWorld(snapshot); const runner = new TestGameRunner(world, 189, 1); - const gen0 = world.getAllGenerals().find((g) => g.name === 'General_0')!; - const gen1 = world.getAllGenerals().find((g) => g.name === 'General_1')!; + const gen0 = world.getAllGenerals().find((g) => g.name.endsWith('General_0'))!; + const gen1 = world.getAllGenerals().find((g) => g.name.endsWith('General_1'))!; const foundNationDef = foundNationSpec.createDefinition(systemEnv); const uprisingDef = uprisingSpec.createDefinition(systemEnv); @@ -288,7 +288,7 @@ describe('Blank Start Scenario', () => { options: { includeNeutralNation: true, defaultGeneralGold: 1000, defaultGeneralRice: 1000 }, }); const world = new InMemoryWorld(bootstrapResult.snapshot); - const gen0 = world.getAllGenerals().find((g) => g.name === 'General_0')!; + const gen0 = world.getAllGenerals().find((g) => g.name.endsWith('General_0'))!; // Setup monarch in wandering nation but city level is 1 (수) const newNation: Nation = { @@ -334,7 +334,7 @@ describe('Blank Start Scenario', () => { options: { includeNeutralNation: true }, }); const world = new InMemoryWorld(bootstrapResult.snapshot); - const gen0 = world.getAllGenerals().find((g) => g.name === 'General_0')!; + const gen0 = world.getAllGenerals().find((g) => g.name.endsWith('General_0'))!; const foundNationDef = foundNationSpec.createDefinition(systemEnv); // Setup monarch and enough generals diff --git a/packages/logic/test/scenarios/reservedTurnExecution.test.ts b/packages/logic/test/scenarios/reservedTurnExecution.test.ts index ae89955..2c6392a 100644 --- a/packages/logic/test/scenarios/reservedTurnExecution.test.ts +++ b/packages/logic/test/scenarios/reservedTurnExecution.test.ts @@ -265,9 +265,9 @@ describe('Reserved Turn Execution', () => { // 3. Define Reserved Turns // This is "Setting all generals' reserved turns" - const gen0 = world.getAllGenerals().find((g) => g.name === 'General_0')!; - const gen1 = world.getAllGenerals().find((g) => g.name === 'General_1')!; - const gen2 = world.getAllGenerals().find((g) => g.name === 'General_2')!; + const gen0 = world.getAllGenerals().find((g) => g.name.endsWith('General_0'))!; + const gen1 = world.getAllGenerals().find((g) => g.name.endsWith('General_1'))!; + const gen2 = world.getAllGenerals().find((g) => g.name.endsWith('General_2'))!; const reservedTurns: ReservedTurnMap = { [gen0.id]: [ diff --git a/tools/integration-tests/test/auctionFlow.test.ts b/tools/integration-tests/test/auctionFlow.test.ts index 3c2176c..60a9a6a 100644 --- a/tools/integration-tests/test/auctionFlow.test.ts +++ b/tools/integration-tests/test/auctionFlow.test.ts @@ -278,6 +278,7 @@ describe('auction integration flow', () => { }); await gatewayClient.admin.profiles.updateMeta.mutate({ profileName: 'che:908', + reason: 'integration test setup', patch: { localAccountGeneralCreationGraceDays: 7, }, diff --git a/tools/integration-tests/test/initialization.test.ts b/tools/integration-tests/test/initialization.test.ts index 4b1a6df..ef4f670 100644 --- a/tools/integration-tests/test/initialization.test.ts +++ b/tools/integration-tests/test/initialization.test.ts @@ -242,6 +242,7 @@ describe('integration initialization flow', () => { }); await gatewayClient.admin.profiles.updateMeta.mutate({ profileName: 'che:2', + reason: 'integration test setup', patch: { localAccountGeneralCreationGraceDays: 7, }, diff --git a/tools/integration-tests/test/orchestrator.e2e.test.ts b/tools/integration-tests/test/orchestrator.e2e.test.ts index 86341ee..3304a60 100644 --- a/tools/integration-tests/test/orchestrator.e2e.test.ts +++ b/tools/integration-tests/test/orchestrator.e2e.test.ts @@ -564,6 +564,7 @@ describe('pm2 orchestrator e2e', () => { }); await gatewayClient.admin.profiles.updateMeta.mutate({ profileName, + reason: 'integration test setup', patch: { localAccountGeneralCreationGraceDays: 7, }, diff --git a/tools/integration-tests/test/tournamentLifecycle.test.ts b/tools/integration-tests/test/tournamentLifecycle.test.ts index 53dd6a3..47700cd 100644 --- a/tools/integration-tests/test/tournamentLifecycle.test.ts +++ b/tools/integration-tests/test/tournamentLifecycle.test.ts @@ -208,6 +208,7 @@ describe('actual tournament lifecycle', () => { }); await gatewayClient.admin.profiles.updateMeta.mutate({ profileName: 'che:908', + reason: 'integration test setup', patch: { localAccountGeneralCreationGraceDays: 7, },