Skip to content

Commit

Permalink
fix tests - unpin items on purchasing eggs / hatchingPotions
Browse files Browse the repository at this point in the history
  • Loading branch information
negue committed Aug 20, 2017
1 parent ec2c934 commit 2efae83
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 3 additions & 5 deletions website/client/components/tasks/user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,10 @@ export default {
buyItem (item) {
if (item.purchaseType === 'card') {
this.selectedCardToBuy = item;
} else if (item.currency === 'gold') {
this.$store.dispatch('shops:buyItem', {key: item.key});
} else {
if (item.currency === 'gold') {
this.$store.dispatch('shops:buyItem', {key: item.key});
} else {
this.$store.dispatch('shops:purchase', {type: item.purchaseType, key: item.key});
}
this.$store.dispatch('shops:purchase', {type: item.purchaseType, key: item.key});
}
},
openBuyDialog (rewardItem) {
Expand Down
2 changes: 2 additions & 0 deletions website/common/script/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ api.bundles = {
return moment().isBetween('2017-05-16', '2017-05-31');
},
type: 'quests',
class: 'quest_bundle_featheredFriends',
value: 7,
},
splashyPals: {
Expand All @@ -86,6 +87,7 @@ api.bundles = {
return moment().isBetween('2017-07-11', '2017-08-02');
},
type: 'quests',
class: 'quest_bundle_splashyPals',
value: 7,
},
};
Expand Down
2 changes: 1 addition & 1 deletion website/common/script/content/shop-featuredItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const featuredItems = {
path: 'armoire',
},
{
type: 'hatchingPotion',
type: 'hatchingPotions',
path: 'hatchingPotions.Golden',
},
{
Expand Down
14 changes: 7 additions & 7 deletions website/common/script/libs/getItemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function getItemInfo (user, type, item, language = 'en') {
let itemInfo;

switch (type) {
case 'egg':
case 'eggs':
itemInfo = {
key: item.key,
text: i18n.t('egg', {eggType: item.text(language)}, language),
Expand All @@ -55,10 +55,10 @@ module.exports = function getItemInfo (user, type, item, language = 'en') {
currency: 'gems',
purchaseType: 'eggs',
path: `eggs.${item.key}`,
pinType: 'egg',
pinType: 'eggs',
};
break;
case 'hatchingPotion':
case 'hatchingPotions':
itemInfo = {
key: item.key,
text: i18n.t('potion', {potionType: item.text(language)}),
Expand All @@ -69,7 +69,7 @@ module.exports = function getItemInfo (user, type, item, language = 'en') {
currency: 'gems',
purchaseType: 'hatchingPotions',
path: `hatchingPotions.${item.key}`,
pinType: 'hatchingPotion',
pinType: 'hatchingPotions',
};
break;
case 'premiumHatchingPotion':
Expand Down Expand Up @@ -100,17 +100,17 @@ module.exports = function getItemInfo (user, type, item, language = 'en') {
pinType: 'food',
};
break;
case 'questBundle':
case 'bundles':
itemInfo = {
key: item.key,
text: item.text(language),
notes: item.notes(language),
value: item.value,
currency: 'gems',
class: `quest_bundle_${item.key}`,
class: item.class,
purchaseType: 'bundles',
path: `bundles.${item.key}`,
pinType: 'questBundle',
pinType: 'bundles',
};
break;
case 'quests': // eslint-disable-line no-case-declarations
Expand Down
6 changes: 3 additions & 3 deletions website/common/script/libs/shops.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ shops.getMarketCategories = function getMarket (user, language) {
.filter(egg => egg.canBuy(user))
.concat(values(content.dropEggs))
.map(egg => {
return getItemInfo(user, 'egg', egg, language);
return getItemInfo(user, 'eggs', egg, language);
}), 'key');
categories.push(eggsCategory);

Expand All @@ -36,7 +36,7 @@ shops.getMarketCategories = function getMarket (user, language) {
hatchingPotionsCategory.items = sortBy(values(content.hatchingPotions)
.filter(hp => !hp.limited)
.map(hatchingPotion => {
return getItemInfo(user, 'hatchingPotion', hatchingPotion, language);
return getItemInfo(user, 'hatchingPotions', hatchingPotion, language);
}), 'key');
categories.push(hatchingPotionsCategory);

Expand Down Expand Up @@ -134,7 +134,7 @@ shops.getQuestShopCategories = function getQuestShopCategories (user, language)
bundleCategory.items = sortBy(values(content.bundles)
.filter(bundle => bundle.type === 'quests' && bundle.canBuy())
.map(bundle => {
return getItemInfo(user, 'questBundle', bundle, language);
return getItemInfo(user, 'bundles', bundle, language);
}));

if (bundleCategory.items.length > 0) {
Expand Down

0 comments on commit 2efae83

Please sign in to comment.