Added buy special support to buy route (#9130)

This commit is contained in:
Keith Holliday
2017-10-02 20:31:06 -05:00
committed by GitHub
parent 8a75383c43
commit e01c6cc9a6
2 changed files with 28 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ describe('POST /user/buy/:key', () => {
message: t('messageHealthAlreadyMax'),
});
});
it('buys a piece of gear', async () => {
let key = 'armor_warrior_1';
@@ -64,4 +65,21 @@ describe('POST /user/buy/:key', () => {
expect(user.items.gear.owned.armor_warrior_1).to.eql(true);
});
it('buys a special spell', async () => {
let key = 'spookySparkles';
let item = content.special[key];
await user.update({'stats.gp': 250});
let res = await user.post(`/user/buy/${key}`);
await user.sync();
expect(res.data).to.eql({
items: JSON.parse(JSON.stringify(user.items)), // otherwise dates can't be compared
stats: user.stats,
});
expect(res.message).to.equal(t('messageBought', {
itemText: item.text(),
}));
});
});