mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
* Added check for wacky pet before feeding * added test for feeding wacky pets * Fixed typo in test for feeding wacky pets Co-authored-by: Jack Somers <somersjw9@gmail.com>
This commit is contained in:
@@ -89,6 +89,18 @@ describe('shared.ops.feed', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('does not allow feeding of wacky pets', done => {
|
||||
user.items.pets['Wolf-Veggie'] = 5;
|
||||
user.items.food.Meat = 1;
|
||||
try {
|
||||
feed(user, { params: { pet: 'Wolf-Veggie', food: 'Meat' } });
|
||||
} catch (err) {
|
||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||
expect(err.message).to.equal(i18n.t('messageCannotFeedPet'));
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
it('does not allow feeding of mounts', done => {
|
||||
user.items.pets['Wolf-Base'] = -1;
|
||||
user.items.mounts['Wolf-Base'] = true;
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function feed (user, req = {}, analytics) {
|
||||
throw new NotFound(i18n.t('messageFoodNotFound', req.language));
|
||||
}
|
||||
|
||||
if (pet.type === 'special') {
|
||||
if (pet.type === 'special' || pet.type === 'wacky') {
|
||||
throw new NotAuthorized(i18n.t('messageCannotFeedPet', req.language));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user