mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
Fix quest premium hatching potions in market
This commit is contained in:
parent
1f5de1ab42
commit
2303d5de32
2 changed files with 23 additions and 1 deletions
|
|
@ -56,6 +56,12 @@ describe('shops', () => {
|
||||||
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||||
expect(potions.items.filter(x => x.key === 'Aquatic' || x.key === 'Celestial').length).to.eql(0);
|
expect(potions.items.filter(x => x.key === 'Aquatic' || x.key === 'Celestial').length).to.eql(0);
|
||||||
});
|
});
|
||||||
|
it('returns end date for scheduled premium potions', async () => {
|
||||||
|
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||||
|
potions.items.forEach(potion => {
|
||||||
|
expect(potion.end).to.exist;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('contains unlocked quest premium hatching potions', async () => {
|
it('contains unlocked quest premium hatching potions', async () => {
|
||||||
user.achievements.quests = {
|
user.achievements.quests = {
|
||||||
|
|
@ -72,6 +78,17 @@ describe('shops', () => {
|
||||||
expect(potions.items.length).to.eql(2);
|
expect(potions.items.length).to.eql(2);
|
||||||
expect(potions.items.filter(x => x.key === 'Bronze' || x.key === 'BlackPearl').length).to.eql(0);
|
expect(potions.items.filter(x => x.key === 'Bronze' || x.key === 'BlackPearl').length).to.eql(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not return end date for quest premium potions', async () => {
|
||||||
|
user.achievements.quests = {
|
||||||
|
bronze: 1,
|
||||||
|
blackPearl: 1,
|
||||||
|
};
|
||||||
|
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||||
|
potions.items.filter(x => x.key === 'Bronze' || x.key === 'BlackPearl').forEach(potion => {
|
||||||
|
expect(potion.end).to.not.exist;
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not return items with event data', async () => {
|
it('does not return items with event data', async () => {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,12 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||||
premiumHatchingPotionsCategory.items = sortBy(values(content.hatchingPotions)
|
premiumHatchingPotionsCategory.items = sortBy(values(content.hatchingPotions)
|
||||||
.filter(hp => hp.limited
|
.filter(hp => hp.limited
|
||||||
&& (matchers.match(hp.key) || (hp.questPotion === true && hp.canBuy(user))))
|
&& (matchers.match(hp.key) || (hp.questPotion === true && hp.canBuy(user))))
|
||||||
.map(premiumHatchingPotion => getItemInfo(user, 'premiumHatchingPotion', premiumHatchingPotion, officialPinnedItems, language, matchers)), 'key');
|
.map(premiumHatchingPotion => {
|
||||||
|
if (premiumHatchingPotion.questPotion) {
|
||||||
|
return getItemInfo(user, 'premiumHatchingPotion', premiumHatchingPotion, officialPinnedItems, language);
|
||||||
|
}
|
||||||
|
return getItemInfo(user, 'premiumHatchingPotion', premiumHatchingPotion, officialPinnedItems, language, matchers);
|
||||||
|
}), 'key');
|
||||||
if (premiumHatchingPotionsCategory.items.length > 0) {
|
if (premiumHatchingPotionsCategory.items.length > 0) {
|
||||||
categories.push(premiumHatchingPotionsCategory);
|
categories.push(premiumHatchingPotionsCategory);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue