From 77c0931cb13b5f39c7548ac35e3d114f4e763629 Mon Sep 17 00:00:00 2001 From: Jackie Han <41348518+jackiehanyang@users.noreply.github.com> Date: Tue, 9 Aug 2022 10:01:26 -0700 Subject: [PATCH] fix failed unit tests (#303) Signed-off-by: Jackie Han --- public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx index 687b9462..ef078d93 100644 --- a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx @@ -396,7 +396,8 @@ export const AnomalyDetailsChart = React.memo( let annotations = [] as any[]; anomalies.forEach((anomalyTimeSeries: AnomalyData[]) => { annotations.push( - anomalyTimeSeries + Array.isArray(anomalyTimeSeries) ? ( + anomalyTimeSeries .filter((anomaly: AnomalyData) => anomaly.anomalyGrade > 0) .map((anomaly: AnomalyData) => ( { @@ -406,6 +407,7 @@ export const AnomalyDetailsChart = React.memo( }, details: `${JSON.stringify(anomaly)}` })) + ) : [] ); }); return annotations;