mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
fix(shops): don't push if empty
Also corrects text on hatching potions
This commit is contained in:
parent
de1e477ce2
commit
db1c2fd5a2
3 changed files with 15 additions and 5 deletions
|
|
@ -13,6 +13,12 @@ describe('shops', () => {
|
||||||
expect(shopCategories.length).to.be.greaterThan(2);
|
expect(shopCategories.length).to.be.greaterThan(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not contain an empty category', () => {
|
||||||
|
_.each(shopCategories, (category) => {
|
||||||
|
expect(category.items.length).to.be.greaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('does not duplicate identifiers', () => {
|
it('does not duplicate identifiers', () => {
|
||||||
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ api.bundles = {
|
||||||
'owl',
|
'owl',
|
||||||
],
|
],
|
||||||
canBuy () {
|
canBuy () {
|
||||||
return moment().isBetween('2017-05-16', '2017-06-02');
|
return moment().isBetween('2017-05-16', '2017-05-31');
|
||||||
},
|
},
|
||||||
type: 'quests',
|
type: 'quests',
|
||||||
value: 7,
|
value: 7,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||||
.map(hatchingPotion => {
|
.map(hatchingPotion => {
|
||||||
return {
|
return {
|
||||||
key: hatchingPotion.key,
|
key: hatchingPotion.key,
|
||||||
text: hatchingPotion.text(language),
|
text: i18n.t('potion', {potionType: hatchingPotion.text(language)}),
|
||||||
notes: hatchingPotion.notes(language),
|
notes: hatchingPotion.notes(language),
|
||||||
class: `Pet_HatchingPotion_${hatchingPotion.key}`,
|
class: `Pet_HatchingPotion_${hatchingPotion.key}`,
|
||||||
value: hatchingPotion.value,
|
value: hatchingPotion.value,
|
||||||
|
|
@ -76,7 +76,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||||
.map(premiumHatchingPotion => {
|
.map(premiumHatchingPotion => {
|
||||||
return {
|
return {
|
||||||
key: premiumHatchingPotion.key,
|
key: premiumHatchingPotion.key,
|
||||||
text: premiumHatchingPotion.text(language),
|
text: i18n.t('potion', {potionType: premiumHatchingPotion.text(language)}),
|
||||||
notes: `${premiumHatchingPotion.notes(language)} ${premiumHatchingPotion._addlNotes(language)}`,
|
notes: `${premiumHatchingPotion.notes(language)} ${premiumHatchingPotion._addlNotes(language)}`,
|
||||||
class: `Pet_HatchingPotion_${premiumHatchingPotion.key}`,
|
class: `Pet_HatchingPotion_${premiumHatchingPotion.key}`,
|
||||||
value: premiumHatchingPotion.value,
|
value: premiumHatchingPotion.value,
|
||||||
|
|
@ -85,7 +85,9 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||||
purchaseType: 'hatchingPotions',
|
purchaseType: 'hatchingPotions',
|
||||||
};
|
};
|
||||||
}), 'key');
|
}), 'key');
|
||||||
categories.push(premiumHatchingPotionsCategory);
|
if (premiumHatchingPotionsCategory.items.length > 0) {
|
||||||
|
categories.push(premiumHatchingPotionsCategory);
|
||||||
|
}
|
||||||
|
|
||||||
let foodCategory = {
|
let foodCategory = {
|
||||||
identifier: 'food',
|
identifier: 'food',
|
||||||
|
|
@ -185,7 +187,9 @@ shops.getQuestShopCategories = function getQuestShopCategories (user, language)
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
categories.push(bundleCategory);
|
if (bundleCategory.items.length > 0) {
|
||||||
|
categories.push(bundleCategory);
|
||||||
|
}
|
||||||
|
|
||||||
each(content.userCanOwnQuestCategories, type => {
|
each(content.userCanOwnQuestCategories, type => {
|
||||||
let category = {
|
let category = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue