From d3f9fbb5f9ab07c4d5413015d67888ad8b43dddc Mon Sep 17 00:00:00 2001 From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:10:59 -0500 Subject: [PATCH] test: Fix act errors in DatasourcePanelDragOption test (#21410) --- .../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 be8f91eade6aa..8de766da88c97 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( - - - , + , + { 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( - - - , + , + { useDnd: true }, ); - expect(screen.getByTestId('DatasourcePanelDragOption')).toHaveAttribute( - 'draggable', - 'true', - ); + expect( + await screen.findByTestId('DatasourcePanelDragOption'), + ).toHaveAttribute('draggable', 'true'); });