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 08:02:32 UTC

[superset] 01/01: 2 act errors removed from DatasourcePanelDragOption test

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

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

commit e348a43fd76195c15e296e8827c7719e1caf24c9
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Fri Sep 9 03:02:09 2022 -0500

    2 act errors removed from DatasourcePanelDragOption test
---
 .../DatasourcePanelDragOption.test.tsx             | 39 ++++++++++------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanelDragOption/DatasourcePanelDragOption.test.tsx b/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanelDragOption/DatasourcePanelDragOption.test.tsx
index be8f91eade..8de766da88 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanelDragOption/DatasourcePanelDragOption.test.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanelDragOption/DatasourcePanelDragOption.test.tsx
@@ -17,38 +17,35 @@
  * under the License.
  */
 import React from 'react';
-import { DndProvider } from 'react-dnd';
-import { HTML5Backend } from 'react-dnd-html5-backend';
 import { render, screen } from 'spec/helpers/testing-library';
 import { DndItemType } from 'src/explore/components/DndItemType';
 import DatasourcePanelDragOption from '.';
 
-test('should render', () => {
+test('should render', async () => {
   render(
-    <DndProvider backend={HTML5Backend}>
-      <DatasourcePanelDragOption
-        value={{ metric_name: 'test' }}
-        type={DndItemType.Metric}
-      />
-    </DndProvider>,
+    <DatasourcePanelDragOption
+      value={{ metric_name: 'test' }}
+      type={DndItemType.Metric}
+    />,
+    { useDnd: true },
   );
 
-  expect(screen.getByTestId('DatasourcePanelDragOption')).toBeInTheDocument();
+  expect(
+    await screen.findByTestId('DatasourcePanelDragOption'),
+  ).toBeInTheDocument();
   expect(screen.getByText('test')).toBeInTheDocument();
 });
 
-test('should have attribute draggable:true', () => {
+test('should have attribute draggable:true', async () => {
   render(
-    <DndProvider backend={HTML5Backend}>
-      <DatasourcePanelDragOption
-        value={{ metric_name: 'test' }}
-        type={DndItemType.Metric}
-      />
-    </DndProvider>,
+    <DatasourcePanelDragOption
+      value={{ metric_name: 'test' }}
+      type={DndItemType.Metric}
+    />,
+    { useDnd: true },
   );
 
-  expect(screen.getByTestId('DatasourcePanelDragOption')).toHaveAttribute(
-    'draggable',
-    'true',
-  );
+  expect(
+    await screen.findByTestId('DatasourcePanelDragOption'),
+  ).toHaveAttribute('draggable', 'true');
 });