From d3804934244df79c5a8e959138b7bf5b93777244 Mon Sep 17 00:00:00 2001 From: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:23:42 -0400 Subject: [PATCH] fix: Header Actions test refactor (#16336) * fixed tests * Update index.tsx Co-authored-by: Elizabeth Thompson --- .../ReportModal/HeaderReportActionsDropdown/index.tsx | 4 ++-- .../src/dashboard/components/Header/Header.test.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx index bbc30c80a26a4..026a262792e52 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx @@ -49,8 +49,8 @@ export default function HeaderReportActionsDropDown({ any, UserWithPermissionsAndRoles >(state => state.user || state.explore?.user); - const reportsIds = Object.keys(reports); - const report: AlertObject = reports[reportsIds[0]]; + const reportsIds = Object.keys(reports || []); + const report: AlertObject = reports?.[reportsIds[0]]; const [ currentReportDeleting, setCurrentReportDeleting, diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx index ea94aceead179..1a7ae856f95c6 100644 --- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx @@ -57,6 +57,7 @@ const createProps = () => ({ dashboardTitle: 'Dashboard Title', charts: {}, layout: {}, + reports: {}, expandedSlices: {}, css: '', customCss: '',