mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +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);
|
||||
});
|
||||
|
||||
it('does not contain an empty category', () => {
|
||||
_.each(shopCategories, (category) => {
|
||||
expect(category.items.length).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not duplicate identifiers', () => {
|
||||
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ api.bundles = {
|
|||
'owl',
|
||||
],
|
||||
canBuy () {
|
||||
return moment().isBetween('2017-05-16', '2017-06-02');
|
||||
return moment().isBetween('2017-05-16', '2017-05-31');
|
||||
},
|
||||
type: 'quests',
|
||||
value: 7,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
|||
.map(hatchingPotion => {
|
||||
return {
|
||||
key: hatchingPotion.key,
|
||||
text: hatchingPotion.text(language),
|
||||
text: i18n.t('potion', {potionType: hatchingPotion.text(language)}),
|
||||
notes: hatchingPotion.notes(language),
|
||||
class: `Pet_HatchingPotion_${hatchingPotion.key}`,
|
||||
value: hatchingPotion.value,
|
||||
|
|
@ -76,7 +76,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
|||
.map(premiumHatchingPotion => {
|
||||
return {
|
||||
key: premiumHatchingPotion.key,
|
||||
text: premiumHatchingPotion.text(language),
|
||||
text: i18n.t('potion', {potionType: premiumHatchingPotion.text(language)}),
|
||||
notes: `${premiumHatchingPotion.notes(language)} ${premiumHatchingPotion._addlNotes(language)}`,
|
||||
class: `Pet_HatchingPotion_${premiumHatchingPotion.key}`,
|
||||
value: premiumHatchingPotion.value,
|
||||
|
|
@ -85,7 +85,9 @@ shops.getMarketCategories = function getMarket (user, language) {
|
|||
purchaseType: 'hatchingPotions',
|
||||
};
|
||||
}), 'key');
|
||||
categories.push(premiumHatchingPotionsCategory);
|
||||
if (premiumHatchingPotionsCategory.items.length > 0) {
|
||||
categories.push(premiumHatchingPotionsCategory);
|
||||
}
|
||||
|
||||
let foodCategory = {
|
||||
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 => {
|
||||
let category = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue