mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
make market return unlocked quest potions
This commit is contained in:
@@ -4,7 +4,6 @@ import {
|
||||
} from '../../helpers/common.helper';
|
||||
|
||||
import seasonalConfig from '../../../website/common/script/libs/shops-seasonal.config';
|
||||
import { userActivityWebhook } from '../../../website/server/libs/webhook';
|
||||
|
||||
describe('shops', () => {
|
||||
const user = generateUser();
|
||||
@@ -14,6 +13,7 @@ describe('shops', () => {
|
||||
if (clock) {
|
||||
clock.restore();
|
||||
}
|
||||
user.achievements.quests = {};
|
||||
});
|
||||
|
||||
describe('market', () => {
|
||||
@@ -45,6 +45,35 @@ describe('shops', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('premium hatching potions', () => {
|
||||
it('contains current scheduled premium hatching potions', async () => {
|
||||
clock = sinon.useFakeTimers(new Date('2024-04-01'));
|
||||
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||
expect(potions.items.length).to.eql(2);
|
||||
});
|
||||
|
||||
it('does not contain past scheduled premium hatching potions', async () => {
|
||||
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);
|
||||
});
|
||||
|
||||
it('contains unlocked quest premium hatching potions', async () => {
|
||||
user.achievements.quests = {
|
||||
bronze: 1,
|
||||
blackPearl: 1,
|
||||
};
|
||||
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||
expect(potions.items.filter(x => x.key === 'Bronze' || x.key === 'BlackPearl').length).to.eql(2);
|
||||
});
|
||||
|
||||
it('does not contain locked quest premium hatching potions', async () => {
|
||||
clock = sinon.useFakeTimers(new Date('2024-04-01'));
|
||||
const potions = shared.shops.getMarketCategories(user).find(x => x.identifier === 'premiumHatchingPotions');
|
||||
expect(potions.items.length).to.eql(2);
|
||||
expect(potions.items.filter(x => x.key === 'Bronze' || x.key === 'BlackPearl').length).to.eql(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not return items with event data', async () => {
|
||||
shopCategories.forEach(category => {
|
||||
category.items.forEach(item => {
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/* import { each } from 'lodash';
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
} from '../helpers/content.helper'; */
|
||||
// eslint-disable-next-line max-len
|
||||
import moment from 'moment';
|
||||
import {
|
||||
|
||||
@@ -74,7 +74,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||
const matchers = getScheduleMatchingGroup('premiumHatchingPotions');
|
||||
premiumHatchingPotionsCategory.items = sortBy(values(content.hatchingPotions)
|
||||
.filter(hp => hp.limited
|
||||
&& matchers.match(hp.key))
|
||||
&& (matchers.match(hp.key) || (hp.questPotion === true && hp.canBuy(user))))
|
||||
.map(premiumHatchingPotion => getItemInfo(user, 'premiumHatchingPotion', premiumHatchingPotion, officialPinnedItems, language, matchers)), 'key');
|
||||
if (premiumHatchingPotionsCategory.items.length > 0) {
|
||||
categories.push(premiumHatchingPotionsCategory);
|
||||
|
||||
Reference in New Issue
Block a user