Recover stale latest battle ids
This commit is contained in:
@@ -163,6 +163,7 @@ try {
|
||||
version: 1,
|
||||
updatedAt: '2026-07-04T01:00:00.000Z',
|
||||
step: 'fifth-camp',
|
||||
latestBattleId: 'missing-history-entry',
|
||||
battleHistory: {
|
||||
'wrong-history-key': {
|
||||
battleId: 'first-battle-zhuo-commandery',
|
||||
@@ -230,6 +231,10 @@ try {
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.recruits.length === 1,
|
||||
`Expected nested battle history rewards to normalize: ${JSON.stringify(malformedHistory)}`
|
||||
);
|
||||
assert(
|
||||
malformedHistory.latestBattleId === 'first-battle-zhuo-commandery',
|
||||
`Expected stale latestBattleId to recover to the latest valid settlement: ${JSON.stringify(malformedHistory)}`
|
||||
);
|
||||
assert(
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives.length === 1 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives[0].rewardGold === 80 &&
|
||||
@@ -264,7 +269,7 @@ try {
|
||||
const fallback = loadCampaignState();
|
||||
assert(fallback.step === 'second-camp' && fallback.activeSaveSlot === 2, `Expected valid slotted save fallback: ${JSON.stringify(fallback)}`);
|
||||
|
||||
console.log('Verified campaign save normalization, malformed-field/bond/sortie-item/history-key/detail recovery, unknown-step/report/history recovery, unsupported-version rejection, and slotted fallback.');
|
||||
console.log('Verified campaign save normalization, malformed-field/bond/sortie-item/latest-history/detail recovery, unknown-step/report/history recovery, unsupported-version rejection, and slotted fallback.');
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user