Cover sortie supply launch normalization
This commit is contained in:
@@ -25,12 +25,30 @@ const server = await createServer({
|
||||
});
|
||||
|
||||
try {
|
||||
const { campaignStorageKey, loadCampaignState } = await server.ssrLoadModule('/src/game/state/campaignState.ts');
|
||||
const { campaignStorageKey, loadCampaignState, normalizeCampaignSortieItemAssignments } = await server.ssrLoadModule('/src/game/state/campaignState.ts');
|
||||
|
||||
storage.clear();
|
||||
const empty = loadCampaignState();
|
||||
assert(empty.version === 1 && empty.step === 'new', `Expected empty storage to create initial campaign state: ${JSON.stringify(empty)}`);
|
||||
|
||||
const normalizedLaunchSupplies = normalizeCampaignSortieItemAssignments(
|
||||
{
|
||||
'liu-bei': { bean: '9', salve: '2', stone: '4' },
|
||||
'guan-yu': { wine: '3' },
|
||||
'ghost-unit': { bean: '1' },
|
||||
'': { bean: '1' }
|
||||
},
|
||||
new Set(['liu-bei', 'guan-yu'])
|
||||
);
|
||||
assert(
|
||||
normalizedLaunchSupplies['liu-bei']?.bean === 2 &&
|
||||
normalizedLaunchSupplies['liu-bei']?.salve === 1 &&
|
||||
normalizedLaunchSupplies['liu-bei']?.stone === undefined &&
|
||||
normalizedLaunchSupplies['guan-yu']?.wine === 1 &&
|
||||
normalizedLaunchSupplies['ghost-unit'] === undefined,
|
||||
`Expected launch sortie supplies to share save normalization rules: ${JSON.stringify(normalizedLaunchSupplies)}`
|
||||
);
|
||||
|
||||
storage.clear();
|
||||
storage.set(
|
||||
campaignStorageKey,
|
||||
|
||||
Reference in New Issue
Block a user