'Unable to cover my lines of code wherever there is if else in my components.Also, unable to achieve the same through ternary operator.Suggestions?
if (!actionQueues || !actionItem) {
return null;
}
else{
return ("Not available");
}
I am trying to check for this condition if (!actionQueues || !actionItem) and added else block so that the jest code coverage does not skip the if part while reading the above code.
(!actionQueues || !actionItem)? null:'not available'; Tried this way as well, but the code coverage is still 0 for the component in both the cases.
Also, is there any way if/else can be replaced by optional chaining or any other feature to get the code coverage. Any suggestions are greatly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
