2016-09-10 18:37:10 +00:00
|
|
|
import {
|
|
|
|
|
each,
|
|
|
|
|
} from 'lodash';
|
|
|
|
|
import {
|
|
|
|
|
expectValidTranslationString,
|
|
|
|
|
} from '../helpers/content.helper';
|
|
|
|
|
|
2024-06-28 16:20:21 +00:00
|
|
|
import hatchingPotions from '../../website/common/script/content/hatching-potions';
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2019-10-08 18:45:38 +00:00
|
|
|
describe('hatchingPotions', () => {
|
2024-06-11 16:54:39 +00:00
|
|
|
let clock;
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2024-06-11 16:54:39 +00:00
|
|
|
afterEach(() => {
|
|
|
|
|
if (clock) {
|
|
|
|
|
clock.restore();
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2024-06-11 16:54:39 +00:00
|
|
|
const potionTypes = [
|
|
|
|
|
'drops',
|
|
|
|
|
'quests',
|
|
|
|
|
'premium',
|
|
|
|
|
'wacky',
|
|
|
|
|
];
|
|
|
|
|
potionTypes.forEach(potionType => {
|
|
|
|
|
describe(potionType, () => {
|
|
|
|
|
it('contains basic information about each potion', () => {
|
2024-06-28 16:20:21 +00:00
|
|
|
each(hatchingPotions.all, (potion, key) => {
|
2024-06-11 16:54:39 +00:00
|
|
|
expectValidTranslationString(potion.text);
|
|
|
|
|
expectValidTranslationString(potion.notes);
|
|
|
|
|
expect(potion.canBuy).to.be.a('function');
|
|
|
|
|
expect(potion.value).to.be.a('number');
|
|
|
|
|
expect(potion.key).to.equal(key);
|
|
|
|
|
});
|
2016-09-10 18:37:10 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
2024-06-28 16:20:21 +00:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
});
|
2016-09-10 18:37:10 +00:00
|
|
|
});
|