Files
habitica/test/api/v3/integration/user/buy/POST-user_buy_armoire.test.js
Keith Holliday 7fe2504906 Bulk purchasing (#9196)
* Moved buy tests

* Added mystery buy to buy.js

* Added quest purchasing to buy

* Added buy special

* Moved integration tests to buy folder

* Removed buyGear dependency

* Removed buyArmoire dependency

* Removed buyHealthPotion dependency

* Removed myster, quest and special dependency

* Replaced functions with factory

* Added bulk purchasing to common

* Added bulk purchasing to the api

* Added bulk purchasing to client

* Refactored purchasing function to reduce long method

* Added bulk purchase to gem purchases

* Added bulk purchasing to api

* Added bulk purchasing to gem items on client

* Removed bulk from equipment

* Removed recentlyPurchased

* Fixed style issues and prevented puchasing more gems than are left

* Fixed lint

* Fixed missing keys

* Fixed gem amount notice

* Added quest modal to pinned item

* Added bulk purchase to gem modal

* Fixed styles

* Fixed bulk purchase for spells

* Fixed modal size

* Hid autofill
2017-10-23 16:05:35 -05:00

42 lines
921 B
JavaScript

import {
generateUser,
translate as t,
} from '../../../../../helpers/api-integration/v3';
describe('POST /user/buy-armoire', () => {
let user;
beforeEach(async () => {
user = await generateUser({
'stats.gp': 400,
});
});
// More tests in common code unit tests
it('returns an error if user does not have enough gold', async () => {
await user.update({
'stats.gp': 5,
});
await expect(user.post('/user/buy-armoire'))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('messageNotEnoughGold'),
});
});
it('reduces gold when buying from the armoire', async () => {
await user.post('/user/buy-armoire');
await user.sync();
expect(user.stats.gp).to.equal(300);
});
xit('buys a piece of armoire', async () => {
// Skipped because can't stub predictableRandom correctly
});
});