From 365573189be50ff2e10b73ae4393834cbe385e55 Mon Sep 17 00:00:00 2001 From: lyndsiWilliams Date: Wed, 7 Sep 2022 14:34:28 -0500 Subject: [PATCH 1/2] 5 act errors removed from PopoverDropdown test --- .../PopoverDropdown/PopoverDropdown.test.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx index 2704e11e0cd43..23d4a17692fdc 100644 --- a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx +++ b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx @@ -36,19 +36,19 @@ const defaultProps: PopoverDropdownProps = { onChange: jest.fn(), }; -test('renders with default props', () => { +it('renders with default props', async () => { render(); - expect(screen.getByRole('button')).toBeInTheDocument(); + expect(await screen.findByRole('button')).toBeInTheDocument(); expect(screen.getByRole('button')).toHaveTextContent('Option 1'); }); -test('renders the menu on click', () => { +it('renders the menu on click', async () => { render(); userEvent.click(screen.getByRole('button')); - expect(screen.getByRole('menu')).toBeInTheDocument(); + expect(await screen.findByRole('menu')).toBeInTheDocument(); }); -test('renders with custom button', () => { +it('renders with custom button', async () => { render( { )} />, ); - expect(screen.getByText('Custom Option 1')).toBeInTheDocument(); + expect(await screen.findByText('Custom Option 1')).toBeInTheDocument(); }); -test('renders with custom option', () => { +it('renders with custom option', async () => { render( { />, ); userEvent.click(screen.getByRole('button')); - expect(screen.getByText('Custom Option 1')).toBeInTheDocument(); + expect(await screen.findByText('Custom Option 1')).toBeInTheDocument(); }); -test('triggers onChange', () => { +it('triggers onChange', async () => { render(); userEvent.click(screen.getByRole('button')); - expect(screen.getByText('Option 2')).toBeInTheDocument(); + expect(await screen.findByText('Option 2')).toBeInTheDocument(); userEvent.click(screen.getByText('Option 2')); expect(defaultProps.onChange).toHaveBeenCalled(); }); From 30eb14c540ea06d2d483287c799a35acf378a209 Mon Sep 17 00:00:00 2001 From: lyndsiWilliams Date: Wed, 7 Sep 2022 15:08:47 -0500 Subject: [PATCH 2/2] Change it to test --- .../PopoverDropdown/PopoverDropdown.test.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx index 23d4a17692fdc..2c02eec91ab2f 100644 --- a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx +++ b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx @@ -36,19 +36,19 @@ const defaultProps: PopoverDropdownProps = { onChange: jest.fn(), }; -it('renders with default props', async () => { +test('renders with default props', async () => { render(); expect(await screen.findByRole('button')).toBeInTheDocument(); expect(screen.getByRole('button')).toHaveTextContent('Option 1'); }); -it('renders the menu on click', async () => { +test('renders the menu on click', async () => { render(); userEvent.click(screen.getByRole('button')); expect(await screen.findByRole('menu')).toBeInTheDocument(); }); -it('renders with custom button', async () => { +test('renders with custom button', async () => { render( { expect(await screen.findByText('Custom Option 1')).toBeInTheDocument(); }); -it('renders with custom option', async () => { +test('renders with custom option', async () => { render( { expect(await screen.findByText('Custom Option 1')).toBeInTheDocument(); }); -it('triggers onChange', async () => { +test('triggers onChange', async () => { render(); userEvent.click(screen.getByRole('button')); expect(await screen.findByText('Option 2')).toBeInTheDocument();