refactor: Update test object modifications to use immutable patterns and extend command context with map, unitSet, and cities.

This commit is contained in:
2026-01-07 17:56:10 +00:00
parent b6e1c18203
commit 73c186fa74
2 changed files with 9 additions and 7 deletions
@@ -162,16 +162,15 @@ describe('Blank Start Scenario', () => {
if (city) {
// Manually update nationId in city
const cityIdx = world.snapshot.cities.findIndex(c => c.id === city.id);
const cityToUpdate = world.snapshot.cities[cityIdx];
if (cityToUpdate) cityToUpdate.nationId = newNationId;
world.snapshot.cities[cityIdx] = { ...world.snapshot.cities[cityIdx], nationId: newNationId };
}
const genIdx = world.snapshot.generals.findIndex(g => g.id === generalAfter.id);
const genToUpdate = world.snapshot.generals[genIdx];
if (genToUpdate) {
genToUpdate.nationId = newNationId;
genToUpdate.meta = { ...generalAfter.meta, founding: false };
}
world.snapshot.generals[genIdx] = {
...world.snapshot.generals[genIdx],
nationId: newNationId,
meta: { ...generalAfter.meta, founding: false }
};
}
// 5. Verify