Verify unlock reward settlement
This commit is contained in:
@@ -108,6 +108,14 @@ try {
|
||||
resetCampaignState();
|
||||
const firstScenario = battleScenarios['first-battle-zhuo-commandery'];
|
||||
const alliedFirstBattleUnits = firstScenario.units.filter((unit) => unit.faction === 'ally');
|
||||
const firstScenarioUnlocks = firstScenario.campaignReward?.unlockBattleId
|
||||
? [
|
||||
{
|
||||
battleId: firstScenario.campaignReward.unlockBattleId,
|
||||
title: firstScenario.campaignReward.unlockLabel ?? battleScenarios[firstScenario.campaignReward.unlockBattleId].title
|
||||
}
|
||||
]
|
||||
: [];
|
||||
const firstBattleReport = {
|
||||
battleId: firstScenario.id,
|
||||
battleTitle: firstScenario.title,
|
||||
@@ -120,7 +128,7 @@ try {
|
||||
units: alliedFirstBattleUnits,
|
||||
bonds: firstScenario.bonds.map((bond) => ({ ...bond, battleExp: 0 })),
|
||||
itemRewards: ['Bean x2', 'Iron Sword 1'],
|
||||
campaignRewards: { supplies: ['Bean x2'], equipment: ['Iron Sword 1'], reputation: [], recruits: [], unlocks: [] },
|
||||
campaignRewards: { supplies: ['Bean x2'], equipment: ['Iron Sword 1'], reputation: [], recruits: [], unlocks: firstScenarioUnlocks },
|
||||
completedCampDialogues: [],
|
||||
completedCampVisits: [],
|
||||
createdAt: '2026-07-03T09:00:00.000Z'
|
||||
@@ -135,11 +143,17 @@ try {
|
||||
repeatedSettlement.battleHistory[firstScenario.id]?.rewardGold === 100,
|
||||
`Expected repeated battle report settlement to avoid duplicate gold/items: ${JSON.stringify(repeatedSettlement)}`
|
||||
);
|
||||
assert(
|
||||
repeatedSettlement.firstBattleReport?.campaignRewards?.unlocks[0]?.battleId === 'second-battle-yellow-turban-pursuit' &&
|
||||
repeatedSettlement.firstBattleReport.campaignRewards.unlocks[0].title === firstScenarioUnlocks[0]?.title &&
|
||||
repeatedSettlement.battleHistory[firstScenario.id]?.campaignRewards?.unlocks[0]?.battleId === 'second-battle-yellow-turban-pursuit',
|
||||
`Expected campaign unlock rewards to survive repeated battle report settlement: ${JSON.stringify(repeatedSettlement)}`
|
||||
);
|
||||
setFirstBattleReport({
|
||||
...firstBattleReport,
|
||||
rewardGold: 140,
|
||||
itemRewards: ['Bean x3', 'Wine', 'Iron Armor 1'],
|
||||
campaignRewards: { supplies: ['Bean x3', 'Wine'], equipment: ['Iron Armor 1'], reputation: [], recruits: [], unlocks: [] }
|
||||
campaignRewards: { supplies: ['Bean x3', 'Wine'], equipment: ['Iron Armor 1'], reputation: [], recruits: [], unlocks: firstScenarioUnlocks }
|
||||
});
|
||||
const revisedSettlement = getCampaignState();
|
||||
assert(
|
||||
|
||||
Reference in New Issue
Block a user