feat: complete legacy unique item battle parity
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
projectItemSlots,
|
||||
serializeItemInventory,
|
||||
} from '../src/items/inventory.js';
|
||||
import { listEquippedItemKeys } from '../src/items/utils.js';
|
||||
|
||||
const makeGeneral = (): General => ({
|
||||
id: 7,
|
||||
@@ -58,6 +59,16 @@ describe('GeneralItemInventory', () => {
|
||||
expect(Object.keys(inventory.instances)).toHaveLength(3);
|
||||
});
|
||||
|
||||
it('reads legacy slots without mutating a frozen world snapshot', () => {
|
||||
const general = makeGeneral();
|
||||
general.role.items.item = 'che_치료_환약';
|
||||
const frozen = Object.freeze(general);
|
||||
|
||||
expect(listEquippedItemKeys(frozen)).toEqual(['che_치료_환약']);
|
||||
expect(getEquippedItemInstance(frozen, 'item')?.itemKey).toBe('che_치료_환약');
|
||||
expect(frozen.itemInventory).toBeUndefined();
|
||||
});
|
||||
|
||||
it('keeps consumable charges in the equipped item instance', () => {
|
||||
const general = makeGeneral();
|
||||
equipNewItem(general, 'item', 'che_치료_환약', { charges: 3 });
|
||||
|
||||
Reference in New Issue
Block a user