I started learning Jest framework. Would like to write test case for following method
const valueCheck() = () => {
if (typeof (props.user.value != undefined) && props.user.value){
callResult([]);
} else{
notification.warn(['Wrong value']);
}
}
Not sure how to do that. Please help I am not able to figure this out
you need to test if callResult() or a notification.warn was called when you call valueCheck()
To do this you must use a spy function for valueCheck and notification
Also ,our syntax is incorrect and it can be simplified in a one line arrow function:
const valueCheck = () => props?.user?.value ? callResult() : notification.warn(['Wrong value'])