@jeremyckahn/farmhand
Version:
A farming game
30 lines (25 loc) • 734 B
text/typescript
import { getGrowingPhase } from './getGrowingPhase.js'
describe('getGrowingPhase', () => {
test.each([
[],
[],
[],
[],
])('it returns phase %s when days watered is %s', (phase, daysWatered) => {
const crop = { itemId: 'potato', daysWatered }
expect(getGrowingPhase(crop as any)).toEqual(phase)
})
test.each([
[],
[],
[],
[],
])(
'it handles fractional daysWatered correctly (returns phase %s when days watered is %s for pumpkin)',
(phase, daysWatered) => {
// pumpkin cropTimeline: [3, 1, 1, 1, 1, 1]
const crop = { itemId: 'pumpkin', daysWatered }
expect(getGrowingPhase(crop as any)).toEqual(phase)
}
)
})