mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-04-29 03:18:27 -05:00
support april fools resale in schedule
This commit is contained in:
@@ -19,7 +19,7 @@ function validateMatcher (matcher, checkedDate) {
|
||||
expect(matcher.end).to.be.greaterThan(checkedDate);
|
||||
}
|
||||
|
||||
describe('Content Schedule', () => {
|
||||
describe.only('Content Schedule', () => {
|
||||
beforeEach(() => {
|
||||
clearCachedMatchers();
|
||||
});
|
||||
@@ -96,58 +96,42 @@ describe('Content Schedule', () => {
|
||||
it('sets the end date if its in the same month', () => {
|
||||
const date = new Date('2024-04-03');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
for (const key in matchers) {
|
||||
if (matchers[key]) {
|
||||
validateMatcher(matchers[key], date);
|
||||
}
|
||||
}
|
||||
expect(matchers.backgrounds.end).to.eql(moment('2024-04-07').toDate());
|
||||
});
|
||||
|
||||
it('sets the end date if its in the next day', () => {
|
||||
const date = new Date('2024-05-06T14:00:00.000Z');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
for (const key in matchers) {
|
||||
if (matchers[key]) {
|
||||
validateMatcher(matchers[key], date);
|
||||
}
|
||||
}
|
||||
expect(matchers.backgrounds.end).to.eql(moment('2024-05-07').toDate());
|
||||
});
|
||||
|
||||
it('sets the end date if its on the release day', () => {
|
||||
const date = new Date('2024-05-07');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
for (const key in matchers) {
|
||||
if (matchers[key]) {
|
||||
validateMatcher(matchers[key], date);
|
||||
}
|
||||
}
|
||||
expect(matchers.backgrounds.end).to.eql(moment('2024-06-07').toDate());
|
||||
});
|
||||
|
||||
it('sets the end date if its next month', () => {
|
||||
const date = new Date('2024-05-20T01:00:00.000Z');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
for (const key in matchers) {
|
||||
if (matchers[key]) {
|
||||
validateMatcher(matchers[key], date);
|
||||
}
|
||||
}
|
||||
expect(matchers.backgrounds.end).to.eql(moment('2024-06-07').toDate());
|
||||
});
|
||||
|
||||
it('sets the end date for a gala', () => {
|
||||
const date = new Date('2024-05-20');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
for (const key in matchers) {
|
||||
if (matchers[key]) {
|
||||
validateMatcher(matchers[key], date);
|
||||
}
|
||||
}
|
||||
expect(matchers.seasonalGear.end).to.eql(moment('2024-06-21').toDate());
|
||||
});
|
||||
|
||||
it('contains content for repeating events', () => {
|
||||
const date = new Date('2024-04-15');
|
||||
const matchers = getAllScheduleMatchingGroups(date);
|
||||
expect(matchers.premiumHatchingPotions).to.exist;
|
||||
expect(matchers.premiumHatchingPotions.items.length).to.equal(4);
|
||||
expect(matchers.premiumHatchingPotions.items.indexOf('Garden')).to.not.equal(-1);
|
||||
expect(matchers.premiumHatchingPotions.items.indexOf('Porcelain')).to.not.equal(-1);
|
||||
});
|
||||
|
||||
describe('only contains valid keys for', () => {
|
||||
it('pet quests', () => {
|
||||
const petKeys = Object.keys(QUEST_PETS);
|
||||
|
||||
@@ -51,6 +51,26 @@ export const REPEATING_EVENTS = {
|
||||
end: new Date('1970-03-15T23:59-05:00'),
|
||||
foodSeason: 'Pie',
|
||||
},
|
||||
aprilFoolsResale: {
|
||||
start: new Date('1970-04-07T08:00-05:00'),
|
||||
end: new Date('1970-04-30T23:59-05:00'),
|
||||
content: [
|
||||
{
|
||||
type: 'hatchingPotionQuests',
|
||||
items: [
|
||||
'virtualpet',
|
||||
'waffle',
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
items: [
|
||||
'Garden',
|
||||
'TeaShop',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
namingDay: {
|
||||
start: new Date('1970-07-30T08:00-05:00'),
|
||||
end: new Date('1970-08-01T23:59-05:00'),
|
||||
|
||||
@@ -701,7 +701,6 @@ export const GALA_SCHEDULE = {
|
||||
type: 'seasonalQuests',
|
||||
items: [
|
||||
'egg',
|
||||
'waffle',
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -835,11 +834,11 @@ export function assembleScheduledMatchers (date) {
|
||||
matcher.endMonth = gala.endMonth;
|
||||
});
|
||||
items.push(...galaMatchers);
|
||||
for (const event in getRepeatingEvents(date)) {
|
||||
getRepeatingEvents(date).forEach(event => {
|
||||
if (event.content) {
|
||||
items.push(...event.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user