From 9c285dafb44a75cf0386fd4647a5b43a6fba1a48 Mon Sep 17 00:00:00 2001
From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com>
Date: Mon, 12 Sep 2022 12:01:55 -0300
Subject: [PATCH] test: Fixes act errors in ErrorMessage tests (#21414)
---
.../src/components/ErrorMessage/BasicErrorAlert.test.tsx | 7 +++++++
.../components/ErrorMessage/DatabaseErrorMessage.test.tsx | 7 +++++++
.../ErrorMessage/DatasetNotFoundErrorMessage.test.tsx | 7 +++++++
.../ErrorMessage/ErrorMessageWithStackTrace.test.tsx | 7 +++++++
.../components/ErrorMessage/ParameterErrorMessage.test.tsx | 7 +++++++
.../components/ErrorMessage/TimeoutErrorMessage.test.tsx | 7 +++++++
6 files changed, 42 insertions(+)
diff --git a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
index b6be9a1b9f..dd2187c931 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 6959c5351a..c8dbe8ba34 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/DatasetNotFoundErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx
index 087b08fa8f..e73d2eb93b 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 6e343eba7f..ae30e5cb99 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',
diff --git a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx
index 17f38c4d23..e8be71b7e3 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 e41308f538..cc3a8a9a59 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,