I have an if statement with multiple clauses that needs to be covered by code coverage. Only the line with the if statement needs to be covered.
if (customer.email && !customer.email.subject) {
//do something
}
In this case, the customer.email is defined, but the customer.email.subject doesn't exist. I tried something like this...
Both expect statement pass, but it doesn't cover the if statement above. How else can I test this?
expect(customer.email).toBeTruthy()
expect(customer.email.subect).toBeFalsy();
I'm expecting the if statement to be covered by code coverage, but it's not being covered.
Aucun commentaire:
Enregistrer un commentaire