Filter invalid campaign reward unlocks
This commit is contained in:
@@ -656,6 +656,7 @@ try {
|
||||
unlocks: [
|
||||
{ battleId: ' second-battle-yellow-turban-pursuit ', title: ' Next ' },
|
||||
{ battleId: 'second-battle-yellow-turban-pursuit', title: 'Duplicate Next' },
|
||||
{ battleId: 'ghost-battle', title: 'Broken Next' },
|
||||
{ battleId: '', title: 'Broken' },
|
||||
...Array.from({ length: 140 }, (_, index) => ({ battleId: `battle-${index}`, title: `Battle ${index}` }))
|
||||
],
|
||||
@@ -694,7 +695,7 @@ try {
|
||||
malformedReport.firstBattleReport.campaignRewards?.recruits[0].unitId === 'guan-yu' &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.recruits[0].name === 'Guan Yu' &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.recruits.filter((recruit) => recruit.unitId === 'guan-yu').length === 1 &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.unlocks.length === 128 &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.unlocks.length === 1 &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.unlocks[0].battleId === 'second-battle-yellow-turban-pursuit' &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.unlocks[0].title === 'Next' &&
|
||||
malformedReport.firstBattleReport.campaignRewards?.unlocks.filter((unlock) => unlock.battleId === 'second-battle-yellow-turban-pursuit').length === 1 &&
|
||||
@@ -757,7 +758,10 @@ try {
|
||||
equipment: ['Iron Sword'],
|
||||
reputation: 'Fame',
|
||||
recruits: [{ unitId: 'test-recruit', name: 'Test Recruit' }, { broken: true }],
|
||||
unlocks: { corrupted: true },
|
||||
unlocks: [
|
||||
{ battleId: 'ghost-battle', title: 'Ghost Battle' },
|
||||
{ battleId: 'second-battle-yellow-turban-pursuit', title: 'Next Pursuit' }
|
||||
],
|
||||
note: 'x'.repeat(181)
|
||||
},
|
||||
objectives: [
|
||||
@@ -876,9 +880,11 @@ try {
|
||||
`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 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.itemRewards.length === 1 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.equipment[0] === 'Iron Sword' &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.recruits.length === 1 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.unlocks.length === 1 &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.unlocks[0].battleId === 'second-battle-yellow-turban-pursuit' &&
|
||||
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.campaignRewards?.note === undefined,
|
||||
`Expected nested battle history rewards to normalize: ${JSON.stringify(malformedHistory)}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user