From b90457c04f49d51c3a6d1ed276fea6c2db21eb73 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Fri, 28 Jun 2024 11:20:21 -0500 Subject: [PATCH] fix(test): correct hatching potion test --- test/content/hatching-potions.test.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/content/hatching-potions.test.js b/test/content/hatching-potions.test.js index 1d1fd575a5..5d1d37bf65 100644 --- a/test/content/hatching-potions.test.js +++ b/test/content/hatching-potions.test.js @@ -5,7 +5,7 @@ import { expectValidTranslationString, } from '../helpers/content.helper'; -import { all } from '../../website/common/script/content/hatching-potions'; +import hatchingPotions from '../../website/common/script/content/hatching-potions'; describe('hatchingPotions', () => { let clock; @@ -25,7 +25,7 @@ describe('hatchingPotions', () => { potionTypes.forEach(potionType => { describe(potionType, () => { it('contains basic information about each potion', () => { - each(all, (potion, key) => { + each(hatchingPotions.all, (potion, key) => { expectValidTranslationString(potion.text); expectValidTranslationString(potion.notes); expect(potion.canBuy).to.be.a('function'); @@ -35,4 +35,20 @@ describe('hatchingPotions', () => { }); }); }); + + it('does not contain unreleased potions', () => { + clock = sinon.useFakeTimers(new Date('2024-05-20')); + const premiumPotions = hatchingPotions.premium; + expect(premiumPotions.Koi).to.not.exist; + }); + + it('Releases potions when appropriate without needing restarting', () => { + clock = sinon.useFakeTimers(new Date('2024-05-20')); + const mayPotions = hatchingPotions.premium; + clock.restore(); + clock = sinon.useFakeTimers(new Date('2024-06-20')); + const junePotions = hatchingPotions.premium; + expect(junePotions.Koi).to.exist; + expect(Object.keys(mayPotions).length).to.equal(Object.keys(junePotions).length - 1); + }); });