I have created a function in my component. I want to know how can I write unit test cases for that function.
component code is -
const Test = () => {
if(props.Test) {
props.Test();
}
}
my Test code is -
const Test =() => {
console.log("hi");
}
and then pass this Test function into my component. I am getting code coverage is not done in this function. So how to achieve code coverage for this function ?
I am passing a function named Test in this component. I need to check if I am getting this component in props then execute this function. So how Can I write unit test cases for this function in jest ?