Skip to content

Commit

Permalink
Merge patch commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 13, 2023
2 parents ff19d4d + 0b40b74 commit 4e92669
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jeremyckahn/farmhand",
"version": "1.18.1",
"version": "1.18.2",
"publishConfig": {
"access": "public"
},
Expand Down
36 changes: 36 additions & 0 deletions src/game-logic/reducers/sellItem.test.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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)
}
)
})
9 changes: 8 additions & 1 deletion src/utils/isItemAFarmProduct.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

1 comment on commit 4e92669

@vercel
Copy link

@vercel vercel bot commented on 4e92669 Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.