Discount Bundled Quests (#8731)

* refactor(content): split quests file

* feat(purchases): sell bundled quests

* fix(style): address linting errors

* test(bundles): shop and purchase tests

* fix(test): remove only

* test(bundles): check balance deduction

* docs(content): comment bundle structure

* fix(test): account for cumulative balance
This commit is contained in:
Sabe Jones
2017-05-17 20:36:34 -05:00
committed by GitHub
parent 0af1203832
commit e6f605f23a
14 changed files with 2932 additions and 2745 deletions

View File

@@ -9,6 +9,8 @@ import i18n from '../../../website/common/script/i18n';
import {
generateUser,
} from '../../helpers/common.helper';
import forEach from 'lodash/forEach';
import moment from 'moment';
describe('shared.ops.purchase', () => {
const SEASONAL_FOOD = 'Meat';
@@ -200,5 +202,28 @@ describe('shared.ops.purchase', () => {
expect(user.items.gear.owned[key]).to.be.true;
});
it('purchases quest bundles', () => {
let startingBalance = user.balance;
let clock = sandbox.useFakeTimers(moment('2017-05-20').valueOf());
let type = 'bundles';
let key = 'featheredFriends';
let price = 1.75;
let questList = [
'falcon',
'harpy',
'owl',
];
purchase(user, {params: {type, key}});
forEach(questList, (bundledKey) => {
expect(user.items.quests[bundledKey]).to.equal(1);
});
expect(user.balance).to.equal(startingBalance - price);
clock.restore();
});
});
});