make it easier to unequip backgrounds

This commit is contained in:
Phillip Thelen 2024-05-21 15:53:14 +02:00
parent 42cafbeaab
commit 36b589e92d
2 changed files with 9 additions and 0 deletions

View file

@ -274,6 +274,14 @@ describe('PUT /user', () => {
expect(get(updatedUser.preferences, type)).to.eql(item);
});
});
it('updates user when background is unequipped', async () => {
expect(get(user.preferences, 'background')).to.not.eql('');
const updatedUser = await user.put('/user', { 'preferences.background': '' });
expect(get(updatedUser.preferences, 'background')).to.eql('');
});
});
context('Improvement Categories', () => {

View file

@ -97,6 +97,7 @@ const requiresPurchase = {
};
function checkPreferencePurchase (user, path, item) {
if (path === 'background' && item === '') return true;
const itemPath = `${path}.${item}`;
const appearance = _.get(common.content.appearances, itemPath);
if (!appearance) return false;