Ported open mystery item, added unit tests, added route, and integration tests

This commit is contained in:
Keith Holliday
2016-04-01 08:23:40 -05:00
parent 3089658cc7
commit 3fe88fd8d0
7 changed files with 120 additions and 25 deletions
@@ -0,0 +1,26 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('POST /user/open-mystery-item', () => {
let user;
let mysteryItemKey = 'eyewear_special_summerRogue';
beforeEach(async () => {
user = await generateUser({
'purchased.plan.mysteryItems': [mysteryItemKey],
});
});
// More tests in common code unit tests
it('opens a mystery item', async () => {
let response = await user.post(`/user/open-mystery-item`);
await user.sync();
expect(user.items.gear.owned[mysteryItemKey]).to.be.true;
expect(response.message).to.equal(t('mysteryItemOpened'));
expect(response.data).to.deep.equal(user.items.gear.owned);
});
});