Skip to content

Commit

Permalink
add unit test for unlockTool util
Browse files Browse the repository at this point in the history
  • Loading branch information
lstebner committed Jan 22, 2024
1 parent 3c11abc commit a0ba8a2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/utils/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { testCrop } from '../test-utils'
import { items as itemImages, animals } from '../img'
import { cowColors, cropLifeStage, genders, standardCowColors } from '../enums'
import {
cowColors,
cropLifeStage,
genders,
standardCowColors,
toolType,
toolLevel,
} from '../enums'
import { rainbowFertilizer, carrot, carrotSeed, milk1 } from '../data/items'
import { carrotSoup } from '../data/recipes'
import {
Expand Down Expand Up @@ -56,6 +63,7 @@ import {
percentageString,
randomChoice,
transformStateDataForImport,
unlockTool,
} from './index'

jest.mock('../data/maps')
Expand Down Expand Up @@ -1076,3 +1084,15 @@ describe('getGrowingPhase', () => {
expect(getGrowingPhase(crop)).toEqual(phase)
})
})

describe('unlockTool', () => {
it('unlocks the specified tool', () => {
const tools = {
[toolType.SHOVEL]: toolLevel.UNAVAILABLE,
}

const updatedTools = unlockTool(tools, toolType.SHOVEL)

expect(updatedTools[toolType.SHOVEL]).toEqual(toolLevel.DEFAULT)
})
})

0 comments on commit a0ba8a2

Please sign in to comment.