mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +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', () => {
|
describe('seasonalShop', () => {
|
||||||
const shopCategories = shared.shops.getSeasonalShopCategories(user, null, seasonalConfig());
|
const shopCategories = shared.shops.getSeasonalShopCategories(user, null, seasonalConfig());
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|||||||
@@ -586,13 +586,14 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
const categories = [];
|
const categories = [];
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
|
|
||||||
|
const matchers = getScheduleMatchingGroup('backgrounds');
|
||||||
const backgroundCategory = {
|
const backgroundCategory = {
|
||||||
identifier: 'backgrounds',
|
identifier: 'backgrounds',
|
||||||
text: i18n.t('backgrounds', language),
|
text: i18n.t('backgrounds', language),
|
||||||
items: [],
|
items: [],
|
||||||
|
end: matchers.end
|
||||||
};
|
};
|
||||||
|
|
||||||
const matchers = getScheduleMatchingGroup('backgrounds');
|
|
||||||
eachRight(content.backgrounds, (group, key) => {
|
eachRight(content.backgrounds, (group, key) => {
|
||||||
if (matchers.match(key)) {
|
if (matchers.match(key)) {
|
||||||
each(group, bg => {
|
each(group, bg => {
|
||||||
@@ -628,6 +629,10 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
text: i18n.t(`titleHair${hairType}`, language),
|
text: i18n.t(`titleHair${hairType}`, language),
|
||||||
items: [],
|
items: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (hairType === 'color') {
|
||||||
|
category.end = customizationMatcher.end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
eachRight(content.appearances.hair[hairType], (hairStyle, key) => {
|
eachRight(content.appearances.hair[hairType], (hairStyle, key) => {
|
||||||
if (hairStyle.price > 0 && (!user.purchased.hair || !user.purchased.hair[hairType]
|
if (hairStyle.price > 0 && (!user.purchased.hair || !user.purchased.hair[hairType]
|
||||||
@@ -672,6 +677,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (type === 'skin') {
|
if (type === 'skin') {
|
||||||
|
category.end = customizationMatcher.end;
|
||||||
categories.push(category);
|
categories.push(category);
|
||||||
} else {
|
} else {
|
||||||
shirtsCategory = category;
|
shirtsCategory = category;
|
||||||
|
|||||||
Reference in New Issue
Block a user