Merge branch 'api-v3-hourglass-purchase' of https://github.com/TheHollidayInn/habitrpg into TheHollidayInn-api-v3-hourglass-purchase2

This commit is contained in:
Matteo Pagliazzi
2016-04-01 16:28:20 +02:00
8 changed files with 236 additions and 36 deletions
@@ -0,0 +1,25 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('POST /user/purchase-hourglass/:type/:key', () => {
let user;
beforeEach(async () => {
user = await generateUser({
'purchased.plan.consecutive.trinkets': 2,
});
});
// More tests in common code unit tests
it('buys a hourglass pet', async () => {
let response = await user.post('/user/purchase-hourglass/pets/MantisShrimp-Base');
await user.sync();
expect(response.message).to.eql(t('hourglassPurchase'));
expect(user.purchased.plan.consecutive.trinkets).to.eql(1);
expect(user.items.pets).to.eql({'MantisShrimp-Base': 5});
});
});