From afb8e726c6cd776bec54b7f7abb0b787b8f86ed0 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Fri, 9 Sep 2022 11:50:53 -0300 Subject: [PATCH 1/2] test: Fixes act errors in ErrorMessage tests --- .../src/components/ErrorMessage/BasicErrorAlert.test.tsx | 7 +++++++ .../components/ErrorMessage/DatabaseErrorMessage.test.tsx | 7 +++++++ .../components/ErrorMessage/ParameterErrorMessage.test.tsx | 7 +++++++ .../components/ErrorMessage/TimeoutErrorMessage.test.tsx | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx index b6be9a1b9f8cf..dd2187c9315e1 100644 --- a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx @@ -23,6 +23,13 @@ import { supersetTheme } from '@superset-ui/core'; import BasicErrorAlert from './BasicErrorAlert'; import { ErrorLevel } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { body: 'Error body', level: 'warning' as ErrorLevel, diff --git a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx index 6959c5351a7ee..c8dbe8ba345f0 100644 --- a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx @@ -23,6 +23,13 @@ import userEvent from '@testing-library/user-event'; import DatabaseErrorMessage from './DatabaseErrorMessage'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { error: { error_type: ErrorTypeEnum.DATABASE_SECURITY_ACCESS_ERROR, diff --git a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx index 17f38c4d23c57..e8be71b7e3079 100644 --- a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx @@ -23,6 +23,13 @@ import { render, screen } from 'spec/helpers/testing-library'; import ParameterErrorMessage from './ParameterErrorMessage'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { error: { error_type: ErrorTypeEnum.MISSING_TEMPLATE_PARAMS_ERROR, diff --git a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx index e41308f5381b5..cc3a8a9a599e4 100644 --- a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx @@ -23,6 +23,13 @@ import { render, screen } from 'spec/helpers/testing-library'; import TimeoutErrorMessage from './TimeoutErrorMessage'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { error: { error_type: ErrorTypeEnum.FRONTEND_TIMEOUT_ERROR, From abfa1701964a663761fdca9a263daecd3e31032c Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Fri, 9 Sep 2022 13:23:08 -0300 Subject: [PATCH 2/2] Adds more tests --- .../ErrorMessage/DatasetNotFoundErrorMessage.test.tsx | 7 +++++++ .../ErrorMessage/ErrorMessageWithStackTrace.test.tsx | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx index 087b08fa8f865..e73d2eb93b6a9 100644 --- a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx @@ -22,6 +22,13 @@ import { render, screen } from 'spec/helpers/testing-library'; import DatasetNotFoundErrorMessage from './DatasetNotFoundErrorMessage'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { error: { error_type: ErrorTypeEnum.FAILED_FETCHING_DATASOURCE_INFO_ERROR, diff --git a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx index 6e343eba7ff20..ae30e5cb991bd 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx @@ -23,6 +23,13 @@ import userEvent from '@testing-library/user-event'; import ErrorMessageWithStackTrace from './ErrorMessageWithStackTrace'; import { ErrorLevel, ErrorSource } from './types'; +jest.mock( + 'src/components/Icons/Icon', + () => + ({ fileName }: { fileName: string }) => + , +); + const mockedProps = { level: 'warning' as ErrorLevel, link: 'https://sample.com',