Files
habitica/test/api/v3/integration/user/GET-user_toggle-pinned-item.test.js
Aleksey 5b57d91a9b Fix: Antidotes to Avatar Transformation Items should be added to Rewards by API (#11353)
* Fix: moved debuffPotions from vue component

- Move logic of choosing proper debuf potion from vue component to website commons
- introduce new function to get debuffSpellItems

* Fix: move debuffPotions to server

* Refactoring: move setting of debuff potion to func

* Fix: sanity

* Refactoring & Tests:

- Create test case for get and set DebuffPotionItems functions
- Fix setDebuffPotionItems function to not create duplicated debuff items
- Make debuff potion type of items unpinnable
- Move list of debuffs to constant to reuse it in tests and functions

* Fix: typo in test describe

* Fix: translation of unpin

* Fix: setDebuffPotionItems on cron buffs reset

* Fix: use full path for debuff potions
2019-10-06 18:41:39 +02:00

28 lines
707 B
JavaScript

import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('GET /user/toggle-pinned-item', () => {
let user;
before(async () => {
user = await generateUser();
});
it('cannot unpin potion', async () => {
await expect(user.get('/user/toggle-pinned-item/potion/potion'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('cannotUnpinItem'),
});
});
it('can pin shield_rogue_5', async () => {
let result = await user.get('/user/toggle-pinned-item/marketGear/gear.flat.shield_rogue_5');
expect(result.pinnedItems.length).to.be.eql(user.pinnedItems.length + 1);
});
});