From ffbe8a510ede0918ac4a919ccd29f4fe982a3fc3 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sun, 5 Jul 2026 10:17:24 +0900 Subject: [PATCH] Cover sortie supply launch normalization --- .../verify-campaign-save-normalization.mjs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/verify-campaign-save-normalization.mjs b/scripts/verify-campaign-save-normalization.mjs index 45b6873..00815c8 100644 --- a/scripts/verify-campaign-save-normalization.mjs +++ b/scripts/verify-campaign-save-normalization.mjs @@ -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,