mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
GP will not be deducted if health is max
This commit is contained in:
@@ -31,6 +31,7 @@ describe('POST /user/buy/:key', () => {
|
||||
it('buys a potion', async () => {
|
||||
await user.update({
|
||||
'stats.gp': 400,
|
||||
'stats.hp': 40,
|
||||
});
|
||||
|
||||
let potion = content.potion;
|
||||
@@ -42,6 +43,19 @@ describe('POST /user/buy/:key', () => {
|
||||
expect(res.message).to.equal(t('messageBought', {itemText: potion.text()}));
|
||||
});
|
||||
|
||||
it('returns an error if user tries to buy a potion with full health', async () => {
|
||||
await user.update({
|
||||
'stats.gp': 40,
|
||||
'stats.hp': 50,
|
||||
});
|
||||
|
||||
await expect(user.post('/user/buy/potion'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('messageHealthAlreadyMax'),
|
||||
});
|
||||
});
|
||||
it('buys a piece of gear', async () => {
|
||||
let key = 'armor_warrior_1';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user