You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2023/01/19 16:36:11 UTC
[superset] 17/21: Fix DatabaseModal test by mocking useHistory hook
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0d72171d9cf68e8427d881a43029128c2e98d899
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 18:28:36 2023 -0600
Fix DatabaseModal test by mocking useHistory hook
---
.../src/views/CRUD/data/database/DatabaseModal/index.test.tsx | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
index ebc20eb388..9542450f44 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
@@ -43,6 +43,14 @@ jest.mock('@superset-ui/core', () => ({
isFeatureEnabled: () => true,
}));
+const mockHistoryPush = jest.fn();
+jest.mock('react-router-dom', () => ({
+ ...jest.requireActual('react-router-dom'),
+ useHistory: () => ({
+ push: mockHistoryPush,
+ }),
+}));
+
const dbProps = {
show: true,
database_name: 'my database',