test live sortie outer lifecycle matrix

This commit is contained in:
2026-07-26 23:42:40 +00:00
parent 740c4bb1db
commit 118f9f5194
@@ -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<string, unknown>)?.command).toBe(
(afterActor?.lastTurn as Record<string, unknown>)?.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));
}
}
}