failed to run the test. here is the error: ● Test suite failed to run Cannot spy the checkInitCompleted property because it is not a function; undefined given instead
my handlers.js:
import { updateGold } from "./functions.js";
export const checkInitCompleted = (term, state) => {
term.moveTo(1, 1)
term.eraseLineAfter()
term.bold.green('You can purchase producers by clicking the number button (1, 2, 3,)')
term.moveTo(0, 2)
term.bold.yellow(`GOLD: ${state.gold}`)
term.moveTo(0, 3)
term.bold.red(`PRODUCTION RATE: ${state.productionRate}`)
}
export const handleKeyPress = (term, state) => {
return (name, matches, data) => {
const key = String.fromCharCode(data.code);
key === 'g' || key === 'G'? state.gold++: false;
for (const i in state.producers) {
if (key === `${state.producers[i].id}` && state.gold >= state.producers[i].cost) {
checkInitCompleted(term, state)
state.gold -= state.producers[i].cost
state.producers[i].cost *= state.producers[i].growthRate
state.producers[i].count++
state.productionRate+=state.producers[i].baseProduction
}
}
}
}
export const handleStateChange = (term, state) => {
return () => updateGold(term, state)
}