test live sortie outer lifecycle matrix
This commit is contained in:
@@ -103,12 +103,31 @@ integration('core ↔ legacy command-boundary differential', () => {
|
|||||||
['live sortie emergency capital', 'fixtures/turn-differential/live-sortie-emergency-capital.json'],
|
['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 conflict arbitration', 'fixtures/turn-differential/live-sortie-conflict-arbitration.json'],
|
||||||
['live sortie tied conflict', 'fixtures/turn-differential/live-sortie-conflict-tie.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',
|
'%s matches command RNG and canonical state delta',
|
||||||
async (label, fixturePath) => {
|
async (label, fixturePath) => {
|
||||||
const request = readFixture(fixturePath);
|
const request = readFixture(fixturePath);
|
||||||
request.includeLifecycle = label === 'live sortie outer lifecycle';
|
request.includeLifecycle = label.startsWith('live sortie outer lifecycle:');
|
||||||
if (request.action === 'che_출병') {
|
if (request.action === 'che_출병') {
|
||||||
request.observe!.includeNationHistoryLogs = true;
|
request.observe!.includeNationHistoryLogs = true;
|
||||||
request.observe!.includeGlobalHistoryLogs = 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);
|
expect(reference.after.generals.find((general) => general.id === 1)?.cityId).toBe(3);
|
||||||
}
|
}
|
||||||
if (request.includeLifecycle) {
|
if (request.includeLifecycle) {
|
||||||
const beforeActor = reference.before.generals.find((general) => general.id === 1);
|
const actorGeneralId = request.actorGeneralId;
|
||||||
const afterActor = reference.after.generals.find((general) => general.id === 1);
|
const beforeActor = reference.before.generals.find((general) => general.id === actorGeneralId);
|
||||||
const coreBeforeActor = core.before.generals.find((general) => general.id === 1);
|
const afterActor = reference.after.generals.find((general) => general.id === actorGeneralId);
|
||||||
const coreAfterActor = core.after.generals.find((general) => general.id === 1);
|
const coreBeforeActor = core.before.generals.find((general) => general.id === actorGeneralId);
|
||||||
|
const coreAfterActor = core.after.generals.find((general) => general.id === actorGeneralId);
|
||||||
expect(
|
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_출병');
|
).toBe('che_출병');
|
||||||
expect(
|
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('휴식');
|
).toBe('휴식');
|
||||||
expect(timestampMillis(afterActor?.turnTime) - timestampMillis(beforeActor?.turnTime)).toBe(
|
expect(timestampMillis(afterActor?.turnTime) - timestampMillis(beforeActor?.turnTime)).toBe(
|
||||||
10 * 60_000
|
10 * 60_000
|
||||||
@@ -198,16 +222,16 @@ integration('core ↔ legacy command-boundary differential', () => {
|
|||||||
expect((coreAfterActor?.lastTurn as Record<string, unknown>)?.command).toBe(
|
expect((coreAfterActor?.lastTurn as Record<string, unknown>)?.command).toBe(
|
||||||
(afterActor?.lastTurn as Record<string, unknown>)?.command
|
(afterActor?.lastTurn as Record<string, unknown>)?.command
|
||||||
);
|
);
|
||||||
for (const generalId of [1, 2]) {
|
for (const referenceGeneral of reference.after.generals) {
|
||||||
const referenceRecentWar = reference.after.generals.find(
|
|
||||||
(general) => general.id === generalId
|
|
||||||
)?.recentWarTime;
|
|
||||||
const coreRecentWar = core.after.generals.find(
|
const coreRecentWar = core.after.generals.find(
|
||||||
(general) => general.id === generalId
|
(general) => general.id === referenceGeneral.id
|
||||||
)?.recentWarTime;
|
)?.recentWarTime;
|
||||||
expect(referenceRecentWar).not.toBeNull();
|
if (referenceGeneral.recentWarTime == null) {
|
||||||
expect(coreRecentWar).not.toBeNull();
|
expect(coreRecentWar).toBeNull();
|
||||||
expect(timestampMillis(coreRecentWar)).toBe(timestampMillis(referenceRecentWar));
|
} else {
|
||||||
|
expect(coreRecentWar).not.toBeNull();
|
||||||
|
expect(timestampMillis(coreRecentWar)).toBe(timestampMillis(referenceGeneral.recentWarTime));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user