diff --git a/test/common/libs/shops.test.js b/test/common/libs/shops.test.js index a4caf542e4..a58c0678bd 100644 --- a/test/common/libs/shops.test.js +++ b/test/common/libs/shops.test.js @@ -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(); diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js index 9faa4d1bf9..183ae23ba9 100644 --- a/website/common/script/libs/shops.js +++ b/website/common/script/libs/shops.js @@ -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;