'How do you test a statement with no return React Jest Enzyme
I am learning jest, enzyme and i just cant figure out something so simple. My problem is that this condition is inside of another function. I need to check if the state obj is not null then assign some variables and test it. When I check code coverage it shows that the if statement is not covered. thanks
async handleButton() {
if (this.state.obj !== null) {
var employee = this.state.obj.employee.name;
var employeeId = this.state.obj.employee.id;
}
await this.setState({
updateObj: {...someOldObj, employee, employeeId};
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
