mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
fix buying animal gear
This commit is contained in:
parent
a8726eee0b
commit
fbce5aae32
2 changed files with 15 additions and 1 deletions
|
|
@ -33,6 +33,20 @@ describe('POST /user/purchase/:type/:key', () => {
|
||||||
expect(user.items[type][key]).to.equal(1);
|
expect(user.items[type][key]).to.equal(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('purchases animal ears', async () => {
|
||||||
|
await user.post('/user/purchase/gear/headAccessory_special_tigerEars');
|
||||||
|
await user.sync();
|
||||||
|
|
||||||
|
expect(user.items.gear.owned.headAccessory_special_tigerEars).to.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('purchases animal tails', async () => {
|
||||||
|
await user.post('/user/purchase/gear/back_special_pandaTail');
|
||||||
|
await user.sync();
|
||||||
|
|
||||||
|
expect(user.items.gear.owned.back_special_pandaTail).to.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('can convert gold to gems if subscribed', async () => {
|
it('can convert gold to gems if subscribed', async () => {
|
||||||
const oldBalance = user.balance;
|
const oldBalance = user.balance;
|
||||||
await user.updateOne({
|
await user.updateOne({
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export default async function purchase (user, req = {}, analytics) {
|
||||||
if (!matchers.match(item.key)) {
|
if (!matchers.match(item.key)) {
|
||||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||||
}
|
}
|
||||||
} else if (item.klass === 'special') {
|
} else if (item.klass === 'special' && item.gearSet !== 'animal') {
|
||||||
const matchers = getScheduleMatchingGroup('seasonalGear');
|
const matchers = getScheduleMatchingGroup('seasonalGear');
|
||||||
if (!matchers.match(item.set)) {
|
if (!matchers.match(item.set)) {
|
||||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue