mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix(test): make sure error is catched using done() callback
This commit is contained in:
@@ -15,7 +15,7 @@ describe('shared.ops.allocate', () => {
|
|||||||
user = generateUser();
|
user = generateUser();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws an error if an invalid attribute is supplied', () => {
|
it('throws an error if an invalid attribute is supplied', (done) => {
|
||||||
try {
|
try {
|
||||||
allocate(user, {
|
allocate(user, {
|
||||||
query: {stat: 'notValid'},
|
query: {stat: 'notValid'},
|
||||||
@@ -23,15 +23,17 @@ describe('shared.ops.allocate', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(BadRequest);
|
expect(err).to.be.an.instanceof(BadRequest);
|
||||||
expect(err.message).to.equal(i18n.t('invalidAttribute', {attr: 'notValid'}));
|
expect(err.message).to.equal(i18n.t('invalidAttribute', {attr: 'notValid'}));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws an error if the user doesn\'t have attribute points', () => {
|
it('throws an error if the user doesn\'t have attribute points', (done) => {
|
||||||
try {
|
try {
|
||||||
allocate(user);
|
allocate(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('notEnoughAttrPoints'));
|
expect(err.message).to.equal(i18n.t('notEnoughAttrPoints'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ describe('shared.ops.buy', () => {
|
|||||||
expect(user.stats.gp).to.eql(175);
|
expect(user.stats.gp).to.eql(175);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not purchase if not enough gp', () => {
|
it('does not purchase if not enough gp', (done) => {
|
||||||
user.stats.hp = 45;
|
user.stats.hp = 45;
|
||||||
user.stats.gp = 5;
|
user.stats.gp = 5;
|
||||||
try {
|
try {
|
||||||
@@ -68,10 +68,12 @@ describe('shared.ops.buy', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
||||||
|
expect(user.stats.hp).to.eql(45);
|
||||||
|
expect(user.stats.gp).to.eql(5);
|
||||||
|
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(user.stats.hp).to.eql(45);
|
|
||||||
expect(user.stats.gp).to.eql(5);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ describe('shared.ops.buy', () => {
|
|||||||
expect(user.items.gear.equipped).to.have.property('weapon', 'weapon_warrior_1');
|
expect(user.items.gear.equipped).to.have.property('weapon', 'weapon_warrior_1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not buy equipment without enough Gold', () => {
|
it('does not buy equipment without enough Gold', (done) => {
|
||||||
user.stats.gp = 20;
|
user.stats.gp = 20;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -148,9 +150,9 @@ describe('shared.ops.buy', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
||||||
|
expect(user.items.gear.owned).to.not.have.property('armor_warrior_1');
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(user.items.gear.owned).to.not.have.property('armor_warrior_1');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +179,7 @@ describe('shared.ops.buy', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context('failure conditions', () => {
|
context('failure conditions', () => {
|
||||||
it('does not open if user does not have enough gold', () => {
|
it('does not open if user does not have enough gold', (done) => {
|
||||||
shared.fns.predictableRandom.returns(YIELD_EQUIPMENT);
|
shared.fns.predictableRandom.returns(YIELD_EQUIPMENT);
|
||||||
user.stats.gp = 50;
|
user.stats.gp = 50;
|
||||||
|
|
||||||
@@ -189,10 +191,11 @@ describe('shared.ops.buy', () => {
|
|||||||
expect(user.items.gear.owned).to.eql({weapon_warrior_0: true});
|
expect(user.items.gear.owned).to.eql({weapon_warrior_0: true});
|
||||||
expect(user.items.food).to.be.empty;
|
expect(user.items.food).to.be.empty;
|
||||||
expect(user.stats.exp).to.eql(0);
|
expect(user.stats.exp).to.eql(0);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not open without Ultimate Gear achievement', () => {
|
it('does not open without Ultimate Gear achievement', (done) => {
|
||||||
shared.fns.predictableRandom.returns(YIELD_EQUIPMENT);
|
shared.fns.predictableRandom.returns(YIELD_EQUIPMENT);
|
||||||
user.achievements.ultimateGearSets = {healer: false, wizard: false, rogue: false, warrior: false};
|
user.achievements.ultimateGearSets = {healer: false, wizard: false, rogue: false, warrior: false};
|
||||||
|
|
||||||
@@ -204,6 +207,7 @@ describe('shared.ops.buy', () => {
|
|||||||
expect(user.items.gear.owned).to.eql({weapon_warrior_0: true});
|
expect(user.items.gear.owned).to.eql({weapon_warrior_0: true});
|
||||||
expect(user.items.food).to.be.empty;
|
expect(user.items.food).to.be.empty;
|
||||||
expect(user.stats.exp).to.eql(0);
|
expect(user.stats.exp).to.eql(0);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,17 +27,18 @@ describe('shared.ops.buyMysterySet', () => {
|
|||||||
|
|
||||||
context('Mystery Sets', () => {
|
context('Mystery Sets', () => {
|
||||||
context('failure conditions', () => {
|
context('failure conditions', () => {
|
||||||
it('does not grant mystery sets without Mystic Hourglasses', () => {
|
it('does not grant mystery sets without Mystic Hourglasses', (done) => {
|
||||||
try {
|
try {
|
||||||
buyMysterySet(user, {params: {key: '201501'}});
|
buyMysterySet(user, {params: {key: '201501'}});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.eql(i18n.t('notEnoughHourglasses'));
|
expect(err.message).to.eql(i18n.t('notEnoughHourglasses'));
|
||||||
expect(user.items.gear.owned).to.have.property('weapon_warrior_0', true);
|
expect(user.items.gear.owned).to.have.property('weapon_warrior_0', true);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not grant mystery set that has already been purchased', () => {
|
it('does not grant mystery set that has already been purchased', (done) => {
|
||||||
user.purchased.plan.consecutive.trinkets = 1;
|
user.purchased.plan.consecutive.trinkets = 1;
|
||||||
user.items.gear.owned = {
|
user.items.gear.owned = {
|
||||||
weapon_warrior_0: true,
|
weapon_warrior_0: true,
|
||||||
@@ -53,6 +54,7 @@ describe('shared.ops.buyMysterySet', () => {
|
|||||||
expect(err).to.be.an.instanceof(NotFound);
|
expect(err).to.be.an.instanceof(NotFound);
|
||||||
expect(err.message).to.eql(i18n.t('mysterySetNotFound'));
|
expect(err.message).to.eql(i18n.t('mysterySetNotFound'));
|
||||||
expect(user.purchased.plan.consecutive.trinkets).to.eql(1);
|
expect(user.purchased.plan.consecutive.trinkets).to.eql(1);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ describe('shared.ops.buyQuest', () => {
|
|||||||
expect(user.stats.gp).to.equal(5);
|
expect(user.stats.gp).to.equal(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not buy Quests without enough Gold', () => {
|
it('does not buy Quests without enough Gold', (done) => {
|
||||||
user.stats.gp = 1;
|
user.stats.gp = 1;
|
||||||
try {
|
try {
|
||||||
buyQuest(user, {
|
buyQuest(user, {
|
||||||
@@ -41,10 +41,11 @@ describe('shared.ops.buyQuest', () => {
|
|||||||
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
||||||
expect(user.items.quests).to.eql({});
|
expect(user.items.quests).to.eql({});
|
||||||
expect(user.stats.gp).to.equal(1);
|
expect(user.stats.gp).to.equal(1);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not buy nonexistent Quests', () => {
|
it('does not buy nonexistent Quests', (done) => {
|
||||||
user.stats.gp = 9999;
|
user.stats.gp = 9999;
|
||||||
try {
|
try {
|
||||||
buyQuest(user, {
|
buyQuest(user, {
|
||||||
@@ -57,10 +58,11 @@ describe('shared.ops.buyQuest', () => {
|
|||||||
expect(err.message).to.equal(i18n.t('questNotFound', {key: 'snarfblatter'}));
|
expect(err.message).to.equal(i18n.t('questNotFound', {key: 'snarfblatter'}));
|
||||||
expect(user.items.quests).to.eql({});
|
expect(user.items.quests).to.eql({});
|
||||||
expect(user.stats.gp).to.equal(9999);
|
expect(user.stats.gp).to.equal(9999);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not buy Gem-premium Quests', () => {
|
it('does not buy Gem-premium Quests', (done) => {
|
||||||
user.stats.gp = 9999;
|
user.stats.gp = 9999;
|
||||||
try {
|
try {
|
||||||
buyQuest(user, {
|
buyQuest(user, {
|
||||||
@@ -73,6 +75,7 @@ describe('shared.ops.buyQuest', () => {
|
|||||||
expect(err.message).to.equal(i18n.t('questNotGoldPurchasable', {key: 'kraken'}));
|
expect(err.message).to.equal(i18n.t('questNotGoldPurchasable', {key: 'kraken'}));
|
||||||
expect(user.items.quests).to.eql({});
|
expect(user.items.quests).to.eql({});
|
||||||
expect(user.stats.gp).to.equal(9999);
|
expect(user.stats.gp).to.equal(9999);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,16 +17,17 @@ describe('shared.ops.buySpecialSpell', () => {
|
|||||||
user = generateUser();
|
user = generateUser();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws an error if params.key is missing', () => {
|
it('throws an error if params.key is missing', (done) => {
|
||||||
try {
|
try {
|
||||||
buySpecialSpell(user);
|
buySpecialSpell(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(BadRequest);
|
expect(err).to.be.an.instanceof(BadRequest);
|
||||||
expect(err.message).to.equal(i18n.t('missingKeyParam'));
|
expect(err.message).to.equal(i18n.t('missingKeyParam'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws an error if the spell doesn\'t exists', () => {
|
it('throws an error if the spell doesn\'t exists', (done) => {
|
||||||
try {
|
try {
|
||||||
buySpecialSpell(user, {
|
buySpecialSpell(user, {
|
||||||
params: {
|
params: {
|
||||||
@@ -36,10 +37,11 @@ describe('shared.ops.buySpecialSpell', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotFound);
|
expect(err).to.be.an.instanceof(NotFound);
|
||||||
expect(err.message).to.equal(i18n.t('spellNotFound', {spellId: 'notExisting'}));
|
expect(err.message).to.equal(i18n.t('spellNotFound', {spellId: 'notExisting'}));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws an error if the user doesn\'t have enough gold', () => {
|
it('throws an error if the user doesn\'t have enough gold', (done) => {
|
||||||
user.stats.gp = 1;
|
user.stats.gp = 1;
|
||||||
try {
|
try {
|
||||||
buySpecialSpell(user, {
|
buySpecialSpell(user, {
|
||||||
@@ -50,6 +52,7 @@ describe('shared.ops.buySpecialSpell', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
expect(err.message).to.equal(i18n.t('messageNotEnoughGold'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -76,13 +76,14 @@ describe('shared.ops.changeClass', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context('has user.preferences.disableClasses !== true', () => {
|
context('has user.preferences.disableClasses !== true', () => {
|
||||||
it('and less than 3 gems', () => {
|
it('and less than 3 gems', (done) => {
|
||||||
user.balance = 0.5;
|
user.balance = 0.5;
|
||||||
try {
|
try {
|
||||||
changeClass(user);
|
changeClass(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('notEnoughGems'));
|
expect(err.message).to.equal(i18n.t('notEnoughGems'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,53 +18,58 @@ describe('shared.ops.feed', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context('failure conditions', () => {
|
context('failure conditions', () => {
|
||||||
it('does not allow feeding without specifying pet and food', () => {
|
it('does not allow feeding without specifying pet and food', (done) => {
|
||||||
try {
|
try {
|
||||||
feed(user);
|
feed(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(BadRequest);
|
expect(err).to.be.an.instanceof(BadRequest);
|
||||||
expect(err.message).to.equal(i18n.t('missingPetFoodFeed'));
|
expect(err.message).to.equal(i18n.t('missingPetFoodFeed'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding if pet name format is invalid', () => {
|
it('does not allow feeding if pet name format is invalid', (done) => {
|
||||||
try {
|
try {
|
||||||
feed(user, {params: {pet: 'invalid', food: 'food'}});
|
feed(user, {params: {pet: 'invalid', food: 'food'}});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(BadRequest);
|
expect(err).to.be.an.instanceof(BadRequest);
|
||||||
expect(err.message).to.equal(i18n.t('invalidPetName'));
|
expect(err.message).to.equal(i18n.t('invalidPetName'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding if food does not exists', () => {
|
it('does not allow feeding if food does not exists', (done) => {
|
||||||
try {
|
try {
|
||||||
feed(user, {params: {pet: 'valid-pet', food: 'invalid food name'}});
|
feed(user, {params: {pet: 'valid-pet', food: 'invalid food name'}});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotFound);
|
expect(err).to.be.an.instanceof(NotFound);
|
||||||
expect(err.message).to.equal(i18n.t('messageFoodNotFound'));
|
expect(err.message).to.equal(i18n.t('messageFoodNotFound'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding if pet is not owned', () => {
|
it('does not allow feeding if pet is not owned', (done) => {
|
||||||
try {
|
try {
|
||||||
feed(user, {params: {pet: 'not-owned', food: 'Meat'}});
|
feed(user, {params: {pet: 'not-owned', food: 'Meat'}});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotFound);
|
expect(err).to.be.an.instanceof(NotFound);
|
||||||
expect(err.message).to.equal(i18n.t('messagePetNotFound'));
|
expect(err.message).to.equal(i18n.t('messagePetNotFound'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding if food is not owned', () => {
|
it('does not allow feeding if food is not owned', (done) => {
|
||||||
user.items.pets['Wolf-Base'] = 5;
|
user.items.pets['Wolf-Base'] = 5;
|
||||||
try {
|
try {
|
||||||
feed(user, {params: {pet: 'Wolf-Base', food: 'Meat'}});
|
feed(user, {params: {pet: 'Wolf-Base', food: 'Meat'}});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotFound);
|
expect(err).to.be.an.instanceof(NotFound);
|
||||||
expect(err.message).to.equal(i18n.t('messageFoodNotFound'));
|
expect(err.message).to.equal(i18n.t('messageFoodNotFound'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding of special pets', () => {
|
it('does not allow feeding of special pets', (done) => {
|
||||||
user.items.pets['Wolf-Veteran'] = 5;
|
user.items.pets['Wolf-Veteran'] = 5;
|
||||||
user.items.food.Meat = 1;
|
user.items.food.Meat = 1;
|
||||||
try {
|
try {
|
||||||
@@ -72,10 +77,11 @@ describe('shared.ops.feed', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('messageCannotFeedPet'));
|
expect(err.message).to.equal(i18n.t('messageCannotFeedPet'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow feeding of mounts', () => {
|
it('does not allow feeding of mounts', (done) => {
|
||||||
user.items.pets['Wolf-Base'] = -1;
|
user.items.pets['Wolf-Base'] = -1;
|
||||||
user.items.mounts['Wolf-Base'] = true;
|
user.items.mounts['Wolf-Base'] = true;
|
||||||
user.items.food.Meat = 1;
|
user.items.food.Meat = 1;
|
||||||
@@ -84,6 +90,7 @@ describe('shared.ops.feed', () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err).to.be.an.instanceof(NotAuthorized);
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
||||||
expect(err.message).to.equal(i18n.t('messageAlreadyMount'));
|
expect(err.message).to.equal(i18n.t('messageAlreadyMount'));
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('shared.ops.hatch', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow hatching if user lacks specified egg', () => {
|
it('does not allow hatching if user lacks specified egg', (done) => {
|
||||||
user.items.eggs.Wolf = 1;
|
user.items.eggs.Wolf = 1;
|
||||||
user.items.hatchingPotions.Base = 1;
|
user.items.hatchingPotions.Base = 1;
|
||||||
user.items.pets = {};
|
user.items.pets = {};
|
||||||
@@ -41,10 +41,11 @@ describe('shared.ops.hatch', () => {
|
|||||||
expect(user.items.pets).to.be.empty;
|
expect(user.items.pets).to.be.empty;
|
||||||
expect(user.items.eggs.Wolf).to.equal(1);
|
expect(user.items.eggs.Wolf).to.equal(1);
|
||||||
expect(user.items.hatchingPotions.Base).to.equal(1);
|
expect(user.items.hatchingPotions.Base).to.equal(1);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow hatching if user lacks specified hatching potion', () => {
|
it('does not allow hatching if user lacks specified hatching potion', (done) => {
|
||||||
user.items.eggs.Wolf = 1;
|
user.items.eggs.Wolf = 1;
|
||||||
user.items.hatchingPotions.Base = 1;
|
user.items.hatchingPotions.Base = 1;
|
||||||
user.items.pets = {};
|
user.items.pets = {};
|
||||||
@@ -56,10 +57,11 @@ describe('shared.ops.hatch', () => {
|
|||||||
expect(user.items.pets).to.be.empty;
|
expect(user.items.pets).to.be.empty;
|
||||||
expect(user.items.eggs.Wolf).to.equal(1);
|
expect(user.items.eggs.Wolf).to.equal(1);
|
||||||
expect(user.items.hatchingPotions.Base).to.equal(1);
|
expect(user.items.hatchingPotions.Base).to.equal(1);
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow hatching if user already owns target pet', () => {
|
it('does not allow hatching if user already owns target pet', (done) => {
|
||||||
user.items.eggs = {Wolf: 1};
|
user.items.eggs = {Wolf: 1};
|
||||||
user.items.hatchingPotions = {Base: 1};
|
user.items.hatchingPotions = {Base: 1};
|
||||||
user.items.pets = {'Wolf-Base': 10};
|
user.items.pets = {'Wolf-Base': 10};
|
||||||
@@ -71,10 +73,11 @@ describe('shared.ops.hatch', () => {
|
|||||||
expect(user.items.pets).to.eql({'Wolf-Base': 10});
|
expect(user.items.pets).to.eql({'Wolf-Base': 10});
|
||||||
expect(user.items.eggs).to.eql({Wolf: 1});
|
expect(user.items.eggs).to.eql({Wolf: 1});
|
||||||
expect(user.items.hatchingPotions).to.eql({Base: 1});
|
expect(user.items.hatchingPotions).to.eql({Base: 1});
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not allow hatching quest pet egg using premium potion', () => {
|
it('does not allow hatching quest pet egg using premium potion', (done) => {
|
||||||
user.items.eggs = {Cheetah: 1};
|
user.items.eggs = {Cheetah: 1};
|
||||||
user.items.hatchingPotions = {Spooky: 1};
|
user.items.hatchingPotions = {Spooky: 1};
|
||||||
user.items.pets = {};
|
user.items.pets = {};
|
||||||
@@ -86,6 +89,7 @@ describe('shared.ops.hatch', () => {
|
|||||||
expect(user.items.pets).to.be.empty;
|
expect(user.items.pets).to.be.empty;
|
||||||
expect(user.items.eggs).to.eql({Cheetah: 1});
|
expect(user.items.eggs).to.eql({Cheetah: 1});
|
||||||
expect(user.items.hatchingPotions).to.eql({Spooky: 1});
|
expect(user.items.hatchingPotions).to.eql({Spooky: 1});
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user