Recover battle history keys by id
This commit is contained in:
@@ -164,7 +164,7 @@ try {
|
||||
updatedAt: '2026-07-04T01:00:00.000Z',
|
||||
step: 'fifth-camp',
|
||||
battleHistory: {
|
||||
'first-battle-zhuo-commandery': {
|
||||
'wrong-history-key': {
|
||||
battleId: 'first-battle-zhuo-commandery',
|
||||
battleTitle: 'Zhuo Commandery',
|
||||
outcome: 'victory',
|
||||
@@ -220,8 +220,9 @@ try {
|
||||
const malformedHistory = loadCampaignState();
|
||||
assert(
|
||||
Object.keys(malformedHistory.battleHistory).length === 1 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.rewardGold === 120,
|
||||
`Expected malformed battle history entries to be filtered while keeping valid settlements: ${JSON.stringify(malformedHistory)}`
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.rewardGold === 120 &&
|
||||
malformedHistory.battleHistory['wrong-history-key'] === undefined,
|
||||
`Expected malformed battle history entries to be filtered while valid settlements are keyed by battleId: ${JSON.stringify(malformedHistory)}`
|
||||
);
|
||||
assert(
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.itemRewards.length === 1 &&
|
||||
@@ -263,7 +264,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-detail recovery, unknown-step/report/history recovery, unsupported-version rejection, and slotted 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.');
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user