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 2022/09/09 04:39:10 UTC

[superset] 01/01: 6 act errors removed from ExportToCVSDropdown test

This is an automated email from the ASF dual-hosted git repository.

lyndsi pushed a commit to branch lyndsi/ExportToCSVDropdown-act-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit c1d40dff9e228a349d539df3c1aef1a98dc5cdb4
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Sep 8 23:38:51 2022 -0500

    6 act errors removed from ExportToCVSDropdown test
---
 .../ExportToCSVDropdown.test.tsx                   | 42 +++++++++-------------
 1 file changed, 17 insertions(+), 25 deletions(-)

diff --git a/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx b/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
index 5207b5f5ff..144f03aa6f 100644
--- a/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
+++ b/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
@@ -18,21 +18,27 @@
  */
 import React from 'react';
 import userEvent from '@testing-library/user-event';
-import { render, screen } from 'spec/helpers/testing-library';
+import { render, screen, waitFor } from 'spec/helpers/testing-library';
 import { ExportToCSVDropdown } from './index';
 
 const exportCSVOriginal = jest.fn();
 const exportCSVPivoted = jest.fn();
 
-test('Dropdown button with menu renders', () => {
-  render(
-    <ExportToCSVDropdown
-      exportCSVOriginal={exportCSVOriginal}
-      exportCSVPivoted={exportCSVPivoted}
-    >
-      <div>.CSV</div>
-    </ExportToCSVDropdown>,
+const waitForRender = () => {
+  waitFor(() =>
+    render(
+      <ExportToCSVDropdown
+        exportCSVOriginal={exportCSVOriginal}
+        exportCSVPivoted={exportCSVPivoted}
+      >
+        <div>.CSV</div>
+      </ExportToCSVDropdown>,
+    ),
   );
+};
+
+test('Dropdown button with menu renders', () => {
+  waitForRender();
 
   expect(screen.getByText('.CSV')).toBeVisible();
 
@@ -43,14 +49,7 @@ test('Dropdown button with menu renders', () => {
 });
 
 test('Call export csv original on click', () => {
-  render(
-    <ExportToCSVDropdown
-      exportCSVOriginal={exportCSVOriginal}
-      exportCSVPivoted={exportCSVPivoted}
-    >
-      <div>.CSV</div>
-    </ExportToCSVDropdown>,
-  );
+  waitForRender();
 
   userEvent.click(screen.getByText('.CSV'));
   userEvent.click(screen.getByText('Original'));
@@ -59,14 +58,7 @@ test('Call export csv original on click', () => {
 });
 
 test('Call export csv pivoted on click', () => {
-  render(
-    <ExportToCSVDropdown
-      exportCSVOriginal={exportCSVOriginal}
-      exportCSVPivoted={exportCSVPivoted}
-    >
-      <div>.CSV</div>
-    </ExportToCSVDropdown>,
-  );
+  waitForRender();
 
   userEvent.click(screen.getByText('.CSV'));
   userEvent.click(screen.getByText('Pivoted'));