@jeremyckahn/farmhand
Version:
A farming game
44 lines (36 loc) • 1.19 kB
JavaScript
import { toolLevel, toolType } from '../../enums.js'
import { testState } from '../../test-utils/index.js'
import { unlockTool } from './unlockTool.js'
describe('unlockTool', () => {
it('unlocks the specified tool', () => {
const state = testState({
toolLevels: {
[]: toolLevel.DEFAULT,
[]: toolLevel.DEFAULT,
[]: toolLevel.UNAVAILABLE,
[]: toolLevel.DEFAULT,
},
})
const { toolLevels } = unlockTool(state, toolType.SHOVEL)
expect(toolLevels[toolType.SHOVEL]).toEqual(toolLevel.DEFAULT)
})
it('does not alter the rest of the tools', () => {
const state = testState({
toolLevels: {
[]: toolLevel.UNAVAILABLE,
[]: toolLevel.DEFAULT,
[]: toolLevel.GOLD,
[]: toolLevel.DEFAULT,
},
})
const { toolLevels } = unlockTool(state, toolType.SHOVEL)
expect(toolLevels).toMatchInlineSnapshot(`
{
"HOE": "DEFAULT",
"SCYTHE": "GOLD",
"SHOVEL": "DEFAULT",
"WATERING_CAN": "DEFAULT",
}
`)
})
})