mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Add end dates to categories in customizationshop
This commit is contained in:
@@ -344,6 +344,36 @@ describe('shops', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('customizationShop', () => {
|
||||
const shopCategories = shared.shops.getCustomizationsShopCategories(user, null);
|
||||
|
||||
it('does not return items with event data', async () => {
|
||||
shopCategories.forEach(category => {
|
||||
category.items.forEach(item => {
|
||||
expect(item.event, item.key).to.not.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('backgrounds category contains end date', () => {
|
||||
const backgroundCategory = shopCategories.find(cat => cat.identifier === 'backgrounds');
|
||||
expect(backgroundCategory.end).to.exist;
|
||||
expect(backgroundCategory.end).to.be.greaterThan(new Date());
|
||||
});
|
||||
|
||||
it('hair color category contains end date', () => {
|
||||
const colorCategory = shopCategories.find(cat => cat.identifier === 'color');
|
||||
expect(colorCategory.end).to.exist;
|
||||
expect(colorCategory.end).to.be.greaterThan(new Date());
|
||||
});
|
||||
|
||||
it('skin category contains end date', () => {
|
||||
const colorCategory = shopCategories.find(cat => cat.identifier === 'color');
|
||||
expect(colorCategory.end).to.exist;
|
||||
expect(colorCategory.end).to.be.greaterThan(new Date());
|
||||
});
|
||||
});
|
||||
|
||||
describe('seasonalShop', () => {
|
||||
const shopCategories = shared.shops.getSeasonalShopCategories(user, null, seasonalConfig());
|
||||
const today = new Date();
|
||||
|
||||
@@ -586,13 +586,14 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
||||
const categories = [];
|
||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||
|
||||
const matchers = getScheduleMatchingGroup('backgrounds');
|
||||
const backgroundCategory = {
|
||||
identifier: 'backgrounds',
|
||||
text: i18n.t('backgrounds', language),
|
||||
items: [],
|
||||
end: matchers.end
|
||||
};
|
||||
|
||||
const matchers = getScheduleMatchingGroup('backgrounds');
|
||||
eachRight(content.backgrounds, (group, key) => {
|
||||
if (matchers.match(key)) {
|
||||
each(group, bg => {
|
||||
@@ -628,6 +629,10 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
||||
text: i18n.t(`titleHair${hairType}`, language),
|
||||
items: [],
|
||||
};
|
||||
|
||||
if (hairType === 'color') {
|
||||
category.end = customizationMatcher.end;
|
||||
}
|
||||
}
|
||||
eachRight(content.appearances.hair[hairType], (hairStyle, key) => {
|
||||
if (hairStyle.price > 0 && (!user.purchased.hair || !user.purchased.hair[hairType]
|
||||
@@ -672,6 +677,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
||||
}
|
||||
});
|
||||
if (type === 'skin') {
|
||||
category.end = customizationMatcher.end;
|
||||
categories.push(category);
|
||||
} else {
|
||||
shirtsCategory = category;
|
||||
|
||||
Reference in New Issue
Block a user