diff --git a/test/content/index.test.js b/test/content/index.test.js index 54ea054b64..2d39379122 100644 --- a/test/content/index.test.js +++ b/test/content/index.test.js @@ -47,7 +47,7 @@ describe('content index', () => { const junePets = content.petInfo; expect(junePets['Chameleon-Base']).to.not.exist; clock.restore(); - clock = sinon.useFakeTimers(new Date('2024-07-10')); + clock = sinon.useFakeTimers(new Date('2024-07-20')); const julyPets = content.petInfo; expect(julyPets['Chameleon-Base']).to.exist; expect(Object.keys(junePets).length, '').to.equal(Object.keys(julyPets).length - 10); @@ -58,7 +58,7 @@ describe('content index', () => { const juneMounts = content.mountInfo; expect(juneMounts['Chameleon-Base']).to.not.exist; clock.restore(); - clock = sinon.useFakeTimers(new Date('2024-07-10')); + clock = sinon.useFakeTimers(new Date('2024-07-20')); const julyMounts = content.mountInfo; expect(julyMounts['Chameleon-Base']).to.exist; expect(Object.keys(juneMounts).length, '').to.equal(Object.keys(julyMounts).length - 10); diff --git a/test/content/schedule.test.js b/test/content/schedule.test.js index 139fbe8bf2..cfb0b5862c 100644 --- a/test/content/schedule.test.js +++ b/test/content/schedule.test.js @@ -127,8 +127,8 @@ describe('Content Schedule', () => { 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.length).to.equal(5); + expect(matchers.premiumHatchingPotions.items.indexOf('Veggie')).to.not.equal(-1); expect(matchers.premiumHatchingPotions.items.indexOf('Porcelain')).to.not.equal(-1); }); @@ -245,27 +245,33 @@ describe('Content Schedule', () => { it('allows sets matching the month', () => { const date = new Date('2024-07-08'); const matcher = getAllScheduleMatchingGroups(date).timeTravelers; - expect(matcher.match('202307')).to.be.true; - expect(matcher.match('202207')).to.be.true; + expect(matcher.match('202307'), '202307').to.be.true; + expect(matcher.match('202207'), '202207').to.be.true; }); it('disallows sets not matching the month', () => { const date = new Date('2024-07-08'); const matcher = getAllScheduleMatchingGroups(date).timeTravelers; - expect(matcher.match('202306')).to.be.false; - expect(matcher.match('202402')).to.be.false; + expect(matcher.match('202306'), '202306').to.be.false; + expect(matcher.match('202402'), '202402').to.be.false; }); it('disallows sets from current month', () => { const date = new Date('2024-07-08'); const matcher = getAllScheduleMatchingGroups(date).timeTravelers; - expect(matcher.match('202407')).to.be.false; + expect(matcher.match('202407'), '202407').to.be.false; }); it('disallows sets from the future', () => { const date = new Date('2024-07-08'); - const matcher = getAllScheduleMatchingGroups(date).backgrounds; - expect(matcher.match('202507')).to.be.false; + const matcher = getAllScheduleMatchingGroups(date).timeTravelers; + expect(matcher.match('202507'), '202507').to.be.false; + }); + + it('matches sets released in the earlier half of the year', () => { + const date = new Date('2024-07-08'); + const matcher = getAllScheduleMatchingGroups(date).timeTravelers; + expect(matcher.match('202401'), '202401').to.be.true; }); }); }); diff --git a/website/common/script/content/constants/events.js b/website/common/script/content/constants/events.js index 1ff20a8112..3bd0ca5fe8 100644 --- a/website/common/script/content/constants/events.js +++ b/website/common/script/content/constants/events.js @@ -65,7 +65,7 @@ export const REPEATING_EVENTS = { { type: 'premiumHatchingPotions', items: [ - 'Garden', + 'Veggie', 'TeaShop', ], }, diff --git a/website/common/script/content/constants/schedule.js b/website/common/script/content/constants/schedule.js index 8c04a5659b..5e98649c9f 100644 --- a/website/common/script/content/constants/schedule.js +++ b/website/common/script/content/constants/schedule.js @@ -28,7 +28,8 @@ function timeTravelersMatcher (month1, month2) { return function call (item, date) { const month = parseInt(item.substring(4, 6), 10); const year = parseInt(item.substring(0, 4), 10); - if (date.getFullYear() === year && (date.getMonth() + 1) >= month) { + if (date.getFullYear() < year + || (date.getFullYear() === year && (date.getMonth() + 1) === month)) { return false; } return month === month1 || month === month2; @@ -207,6 +208,7 @@ export const MONTHLY_SCHEDULE = { items: [ 'StainedGlass', 'Porcelain', + 'BirchBark', ], }, ],