diff --git a/package-lock.json b/package-lock.json index 0b955cea9..acc662412 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jeremyckahn/farmhand", - "version": "1.18.1", + "version": "1.18.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@jeremyckahn/farmhand", - "version": "1.18.1", + "version": "1.18.2", "license": "GPL-2.0-or-later", "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.27", @@ -11954,9 +11954,9 @@ } }, "node_modules/electron": { - "version": "22.3.21", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.21.tgz", - "integrity": "sha512-9JzWgvehRrqA30M7RvWCwwbyq2EgPUSbCFaqyZGnG0B52m4ayB8H+uFNIKXyWuyFwAEPDpQW5cGwCzXir1HuLA==", + "version": "22.3.25", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.25.tgz", + "integrity": "sha512-AjrP7bebMs/IPsgmyowptbA7jycTkrJC7jLZTb5JoH30PkBC6pZx/7XQ0aDok82SsmSiF4UJDOg+HoLrEBiqmg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -41552,9 +41552,9 @@ } }, "electron": { - "version": "22.3.21", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.21.tgz", - "integrity": "sha512-9JzWgvehRrqA30M7RvWCwwbyq2EgPUSbCFaqyZGnG0B52m4ayB8H+uFNIKXyWuyFwAEPDpQW5cGwCzXir1HuLA==", + "version": "22.3.25", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.3.25.tgz", + "integrity": "sha512-AjrP7bebMs/IPsgmyowptbA7jycTkrJC7jLZTb5JoH30PkBC6pZx/7XQ0aDok82SsmSiF4UJDOg+HoLrEBiqmg==", "dev": true, "requires": { "@electron/get": "^2.0.0", diff --git a/package.json b/package.json index c65ee9794..108aba840 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jeremyckahn/farmhand", - "version": "1.18.1", + "version": "1.18.2", "publishConfig": { "access": "public" }, diff --git a/src/game-logic/reducers/sellItem.test.js b/src/game-logic/reducers/sellItem.test.js index 2f52b89ca..fe16462a0 100644 --- a/src/game-logic/reducers/sellItem.test.js +++ b/src/game-logic/reducers/sellItem.test.js @@ -1,5 +1,8 @@ import { testItem } from '../../test-utils' import { LOAN_PAYOFF } from '../../templates' +import { carrot } from '../../data/crops' +import { bronzeOre, coal, milk1, saltRock } from '../../data/items' +import { carrotSoup } from '../../data/recipes' import { sellItem } from './sellItem' @@ -226,4 +229,37 @@ describe('sellItem', () => { }) }) }) + + const experienceTestArgs = [ + carrot, + milk1, + coal, + carrotSoup, + bronzeOre, + saltRock, + ].map(item => [item.type, item]) + + test.each(experienceTestArgs)( + 'selling item of type %s gives experience', + (_, item) => { + const state = sellItem( + { + experience: 0, + inventory: [testItem({ id: item.id, quantity: 1 })], + itemsSold: {}, + loanBalance: 0, + money: 100, + pendingPeerMessages: [], + todaysNotifications: [], + revenue: 0, + todaysRevenue: 0, + valueAdjustments: { [item.id]: 1 }, + }, + testItem({ id: item.id }), + 1 + ) + + expect(state.experience).toEqual(1) + } + ) }) diff --git a/src/utils/isItemAFarmProduct.js b/src/utils/isItemAFarmProduct.js index 108d8bd87..87fc6a799 100644 --- a/src/utils/isItemAFarmProduct.js +++ b/src/utils/isItemAFarmProduct.js @@ -1,8 +1,15 @@ +/** @typedef {import('../index').farmhand.item} farmhand.item */ import { itemType } from '../enums' import { isItemAGrownCrop } from './isItemAGrownCrop' -const FARM_PRODUCT_TYPES = [itemType.MILK, itemType.CRAFTED_ITEM] +const FARM_PRODUCT_TYPES = [ + itemType.CRAFTED_ITEM, + itemType.FUEL, + itemType.MILK, + itemType.ORE, + itemType.STONE, +] /** * @param {farmhand.item} item