mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
fix(tests): Items Utils > castItemVal fix fn call
This commit is contained in:
@@ -72,42 +72,42 @@ describe('Items Utils', () => {
|
||||
});
|
||||
|
||||
it('returns the item val untouched if an unsupported path', () => {
|
||||
expect(validateItemPath('items.gear.equipped.weapon', 'a string')).to.equal('a string');
|
||||
expect(validateItemPath('items.currentPet', 'a string')).to.equal('a string');
|
||||
expect(validateItemPath('items.special.snowball', 'a string')).to.equal('a string');
|
||||
expect(castItemVal('items.gear.equipped.weapon', 'a string')).to.equal('a string');
|
||||
expect(castItemVal('items.currentPet', 'a string')).to.equal('a string');
|
||||
expect(castItemVal('items.special.snowball', 'a string')).to.equal('a string');
|
||||
});
|
||||
|
||||
it('converts values for pets paths to numbers', () => {
|
||||
expect(validateItemPath('items.pets.Wolf-CottonCandyPink', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.pets.Wolf-Invalid', '5')).to.equal(5);
|
||||
expect(castItemVal('items.pets.Wolf-CottonCandyPink', '5')).to.equal(5);
|
||||
expect(castItemVal('items.pets.Wolf-Invalid', '5')).to.equal(5);
|
||||
});
|
||||
|
||||
it('converts values for eggs paths to numbers', () => {
|
||||
expect(validateItemPath('items.eggs.LionCub', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.eggs.Armadillo', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.eggs.NotAnArmadillo', '5')).to.equal(5);
|
||||
expect(castItemVal('items.eggs.LionCub', '5')).to.equal(5);
|
||||
expect(castItemVal('items.eggs.Armadillo', '5')).to.equal(5);
|
||||
expect(castItemVal('items.eggs.NotAnArmadillo', '5')).to.equal(5);
|
||||
});
|
||||
|
||||
it('converts values for hatching potions paths to numbers', () => {
|
||||
expect(validateItemPath('items.hatchingPotions.Base', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.hatchingPotions.StarryNight', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.hatchingPotions.Invalid', '5')).to.equal(5);
|
||||
expect(castItemVal('items.hatchingPotions.Base', '5')).to.equal(5);
|
||||
expect(castItemVal('items.hatchingPotions.StarryNight', '5')).to.equal(5);
|
||||
expect(castItemVal('items.hatchingPotions.Invalid', '5')).to.equal(5);
|
||||
});
|
||||
|
||||
it('converts values for food paths to numbers', () => {
|
||||
expect(validateItemPath('items.food.Cake_Base', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.food.Cake_Invalid', '5')).to.equal(5);
|
||||
expect(castItemVal('items.food.Cake_Base', '5')).to.equal(5);
|
||||
expect(castItemVal('items.food.Cake_Invalid', '5')).to.equal(5);
|
||||
});
|
||||
|
||||
it('converts values for mounts paths to numbers', () => {
|
||||
expect(validateItemPath('items.mounts.Cactus-Base', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.mounts.Aether-Invisible', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.mounts.Aether-Invalid', '5')).to.equal(5);
|
||||
expect(castItemVal('items.mounts.Cactus-Base', '5')).to.equal(5);
|
||||
expect(castItemVal('items.mounts.Aether-Invisible', '5')).to.equal(5);
|
||||
expect(castItemVal('items.mounts.Aether-Invalid', '5')).to.equal(5);
|
||||
});
|
||||
|
||||
it('converts values for quests paths to numbers', () => {
|
||||
expect(validateItemPath('items.quests.atom3', '5')).to.equal(5);
|
||||
expect(validateItemPath('items.quests.invalid', '5')).to.equal(5);
|
||||
expect(castItemVal('items.quests.atom3', '5')).to.equal(5);
|
||||
expect(castItemVal('items.quests.invalid', '5')).to.equal(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user