mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-04-24 11:40:11 -05:00
@@ -78,6 +78,17 @@ describe('shared.ops.buyGear', () => {
|
||||
expect(user.items.gear.equipped).to.have.property('armor', 'armor_warrior_1');
|
||||
});
|
||||
|
||||
it('updates the pinnedItems to the next item in the set if one exists', () => {
|
||||
user.stats.gp = 31;
|
||||
|
||||
buyGear(user, {params: {key: 'armor_warrior_1'}});
|
||||
|
||||
expect(user.pinnedItems).to.deep.include({
|
||||
type: 'marketGear',
|
||||
path: 'gear.flat.armor_warrior_2',
|
||||
});
|
||||
});
|
||||
|
||||
it('buyGears equipment but does not auto-equip', () => {
|
||||
user.stats.gp = 31;
|
||||
user.preferences.autoEquip = false;
|
||||
|
||||
@@ -19,13 +19,9 @@ function buyItem (store, params) {
|
||||
const quantity = params.quantity || 1;
|
||||
const user = store.state.user.data;
|
||||
|
||||
const userPinned = user.pinnedItems.slice();
|
||||
let opResult = buyOp(user, {params, quantity});
|
||||
|
||||
// @TODO: Currently resetting the pinned items will reset the market. Purchasing some items does not reset pinned.
|
||||
// For now, I've added this hack for items like contributor gear to update while I am working on add more computed
|
||||
// properties to the market. We will use this quick fix while testing the other changes.
|
||||
user.pinnedItems = userPinned;
|
||||
user.pinnedItems = opResult[0].pinnedItems;
|
||||
|
||||
|
||||
return {
|
||||
|
||||
@@ -76,7 +76,7 @@ module.exports = function buyGear (user, req = {}, analytics) {
|
||||
}
|
||||
|
||||
return [
|
||||
pick(user, splitWhitespace('items achievements stats flags')),
|
||||
pick(user, splitWhitespace('items achievements stats flags pinnedItems')),
|
||||
message,
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user