Within my Angular application, I have a straightforward enum
known as AlertType
. One of the properties in an API response object is of this enum
type. Here is an example:
export class ScanAlertModel {
public alertId: string;
public alertType: AlertType
}
In certain scenarios, the alertType
property may not be set. To test these scenarios using Jasmine
, I need to filter an Array<AlertModel>
for items that do not have an alertType
. This is achieved by applying a simple filter like this:
this.scanAlerts.filter((a) => ((a.alertType === null)
Although this works fine within the Angular application, my tests designed to validate this filtering process fail to remove records correctly when the JSON data contains ScanAlertModel
entities without an alertType
.
This discrepancy has left me puzzled. Any guidance on resolving this issue would be greatly appreciated. Thank you.