From 118f9f5194e1d903bd7a2f01164004015ab16b75 Mon Sep 17 00:00:00 2001 From: hided62 Date: Sun, 26 Jul 2026 23:42:40 +0000 Subject: [PATCH] test live sortie outer lifecycle matrix --- ...rnCommandCoreReference.integration.test.ts | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/tools/integration-tests/test/turnCommandCoreReference.integration.test.ts b/tools/integration-tests/test/turnCommandCoreReference.integration.test.ts index 8de63c0..fcf0b74 100644 --- a/tools/integration-tests/test/turnCommandCoreReference.integration.test.ts +++ b/tools/integration-tests/test/turnCommandCoreReference.integration.test.ts @@ -103,12 +103,31 @@ integration('core ↔ legacy command-boundary differential', () => { ['live sortie emergency capital', 'fixtures/turn-differential/live-sortie-emergency-capital.json'], ['live sortie conflict arbitration', 'fixtures/turn-differential/live-sortie-conflict-arbitration.json'], ['live sortie tied conflict', 'fixtures/turn-differential/live-sortie-conflict-tie.json'], - ['live sortie outer lifecycle', 'fixtures/turn-differential/live-sortie-defender.json'], + ['live sortie outer lifecycle: conquest', 'fixtures/turn-differential/live-sortie-conquest.json'], + ['live sortie outer lifecycle: defender', 'fixtures/turn-differential/live-sortie-defender.json'], + [ + 'live sortie outer lifecycle: multiple defenders', + 'fixtures/turn-differential/live-sortie-multiple-defenders.json', + ], + ['live sortie outer lifecycle: supply retreat', 'fixtures/turn-differential/live-sortie-supply-retreat.json'], + [ + 'live sortie outer lifecycle: noncapital conquest', + 'fixtures/turn-differential/live-sortie-noncapital-conquest.json', + ], + [ + 'live sortie outer lifecycle: emergency capital', + 'fixtures/turn-differential/live-sortie-emergency-capital.json', + ], + [ + 'live sortie outer lifecycle: conflict arbitration', + 'fixtures/turn-differential/live-sortie-conflict-arbitration.json', + ], + ['live sortie outer lifecycle: tied conflict', 'fixtures/turn-differential/live-sortie-conflict-tie.json'], ])( '%s matches command RNG and canonical state delta', async (label, fixturePath) => { const request = readFixture(fixturePath); - request.includeLifecycle = label === 'live sortie outer lifecycle'; + request.includeLifecycle = label.startsWith('live sortie outer lifecycle:'); if (request.action === 'che_출병') { request.observe!.includeNationHistoryLogs = true; request.observe!.includeGlobalHistoryLogs = true; @@ -174,15 +193,20 @@ integration('core ↔ legacy command-boundary differential', () => { expect(reference.after.generals.find((general) => general.id === 1)?.cityId).toBe(3); } if (request.includeLifecycle) { - const beforeActor = reference.before.generals.find((general) => general.id === 1); - const afterActor = reference.after.generals.find((general) => general.id === 1); - const coreBeforeActor = core.before.generals.find((general) => general.id === 1); - const coreAfterActor = core.after.generals.find((general) => general.id === 1); + const actorGeneralId = request.actorGeneralId; + const beforeActor = reference.before.generals.find((general) => general.id === actorGeneralId); + const afterActor = reference.after.generals.find((general) => general.id === actorGeneralId); + const coreBeforeActor = core.before.generals.find((general) => general.id === actorGeneralId); + const coreAfterActor = core.after.generals.find((general) => general.id === actorGeneralId); expect( - reference.before.generalTurns.find((turn) => turn.generalId === 1 && turn.turnIndex === 0)?.action + reference.before.generalTurns.find( + (turn) => turn.generalId === actorGeneralId && turn.turnIndex === 0 + )?.action ).toBe('che_출병'); expect( - reference.after.generalTurns.find((turn) => turn.generalId === 1 && turn.turnIndex === 0)?.action + reference.after.generalTurns.find( + (turn) => turn.generalId === actorGeneralId && turn.turnIndex === 0 + )?.action ).toBe('휴식'); expect(timestampMillis(afterActor?.turnTime) - timestampMillis(beforeActor?.turnTime)).toBe( 10 * 60_000 @@ -198,16 +222,16 @@ integration('core ↔ legacy command-boundary differential', () => { expect((coreAfterActor?.lastTurn as Record)?.command).toBe( (afterActor?.lastTurn as Record)?.command ); - for (const generalId of [1, 2]) { - const referenceRecentWar = reference.after.generals.find( - (general) => general.id === generalId - )?.recentWarTime; + for (const referenceGeneral of reference.after.generals) { const coreRecentWar = core.after.generals.find( - (general) => general.id === generalId + (general) => general.id === referenceGeneral.id )?.recentWarTime; - expect(referenceRecentWar).not.toBeNull(); - expect(coreRecentWar).not.toBeNull(); - expect(timestampMillis(coreRecentWar)).toBe(timestampMillis(referenceRecentWar)); + if (referenceGeneral.recentWarTime == null) { + expect(coreRecentWar).toBeNull(); + } else { + expect(coreRecentWar).not.toBeNull(); + expect(timestampMillis(coreRecentWar)).toBe(timestampMillis(referenceGeneral.recentWarTime)); + } } }