fix incorrect Armoire test; remove unneeded param details from apidocs; disambiguate health potion

This commit is contained in:
Alys
2016-05-16 15:20:43 +10:00
parent 6bbfbbf613
commit b676fc0b71
4 changed files with 15 additions and 24 deletions
@@ -2,23 +2,23 @@ import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import shared from '../../../../../common/script';
let content = shared.content;
describe('POST /user/buy-armoire', () => {
let user;
beforeEach(async () => {
user = await generateUser({
'stats.hp': 40,
'stats.gp': 400,
});
});
// More tests in common code unit tests
it('returns an error if user does not have enough gold', async () => {
await expect(user.post('/user/buy-potion'))
await user.update({
'stats.gp': 5,
});
await expect(user.post('/user/buy-armoire'))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
@@ -26,19 +26,14 @@ describe('POST /user/buy-armoire', () => {
});
});
xit('buys a piece of armoire', async () => {
await user.update({
'stats.gp': 400,
});
let potion = content.potion;
let res = await user.post('/user/buy-potion');
it('reduces gold when buying from the armoire', async () => {
await user.post('/user/buy-armoire');
await user.sync();
expect(user.stats.hp).to.equal(50);
expect(res.data).to.eql({
stats: user.stats,
});
expect(res.message).to.equal(t('messageBought', {itemText: potion.text()}));
expect(user.stats.gp).to.equal(300);
});
xit('buys a piece of armoire', async () => {
// Skipped because can't stub predictableRandom correctly
});
});