fix(test): correct hatching potion test

This commit is contained in:
Sabe Jones
2024-06-28 11:20:21 -05:00
parent 379d98a91e
commit b90457c04f

View File

@@ -5,7 +5,7 @@ import {
expectValidTranslationString, expectValidTranslationString,
} from '../helpers/content.helper'; } from '../helpers/content.helper';
import { all } from '../../website/common/script/content/hatching-potions'; import hatchingPotions from '../../website/common/script/content/hatching-potions';
describe('hatchingPotions', () => { describe('hatchingPotions', () => {
let clock; let clock;
@@ -25,7 +25,7 @@ describe('hatchingPotions', () => {
potionTypes.forEach(potionType => { potionTypes.forEach(potionType => {
describe(potionType, () => { describe(potionType, () => {
it('contains basic information about each potion', () => { it('contains basic information about each potion', () => {
each(all, (potion, key) => { each(hatchingPotions.all, (potion, key) => {
expectValidTranslationString(potion.text); expectValidTranslationString(potion.text);
expectValidTranslationString(potion.notes); expectValidTranslationString(potion.notes);
expect(potion.canBuy).to.be.a('function'); 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);
});
}); });