diff --git a/test/common/ops/hatch.js b/test/common/ops/hatch.js index 9c1039f29b..919829d6b8 100644 --- a/test/common/ops/hatch.js +++ b/test/common/ops/hatch.js @@ -93,6 +93,22 @@ describe('shared.ops.hatch', () => { done(); } }); + + it('does not allow hatching quest pet egg using wacky potion', (done) => { + user.items.eggs = {Bunny: 1}; + user.items.hatchingPotions = {Veggie: 1}; + user.items.pets = {}; + try { + hatch(user, {params: {egg: 'Bunny', hatchingPotion: 'Veggie'}}); + } catch (err) { + expect(err).to.be.an.instanceof(BadRequest); + expect(err.message).to.equal(i18n.t('messageInvalidEggPotionCombo')); + expect(user.items.pets).to.be.empty; + expect(user.items.eggs).to.eql({Bunny: 1}); + expect(user.items.hatchingPotions).to.eql({Veggie: 1}); + done(); + } + }); }); context('successful hatching', () => { diff --git a/website/common/script/ops/hatch.js b/website/common/script/ops/hatch.js index 121e45647e..672372e125 100644 --- a/website/common/script/ops/hatch.js +++ b/website/common/script/ops/hatch.js @@ -20,7 +20,7 @@ module.exports = function hatch (user, req = {}) { throw new NotFound(i18n.t('messageMissingEggPotion', req.language)); } - if (content.hatchingPotions[hatchingPotion].premium && !content.dropEggs[egg]) { + if ((content.hatchingPotions[hatchingPotion].premium || content.hatchingPotions[hatchingPotion].wacky) && !content.dropEggs[egg]) { throw new BadRequest(i18n.t('messageInvalidEggPotionCombo', req.language)); }