From 5d1afbcfb2e25487d12d18fe2b598520b201ac36 Mon Sep 17 00:00:00 2001
From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com>
Date: Fri, 9 Sep 2022 18:20:09 -0300
Subject: [PATCH] test: Fixes act errors in PopoverSection test (#21416)
---
.../PopoverSection/PopoverSection.test.tsx | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/superset-frontend/src/components/PopoverSection/PopoverSection.test.tsx b/superset-frontend/src/components/PopoverSection/PopoverSection.test.tsx
index 2135f6ba46..16952834c1 100644
--- a/superset-frontend/src/components/PopoverSection/PopoverSection.test.tsx
+++ b/superset-frontend/src/components/PopoverSection/PopoverSection.test.tsx
@@ -21,23 +21,23 @@ import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import PopoverSection from 'src/components/PopoverSection';
-test('renders with default props', () => {
+test('renders with default props', async () => {
render(
,
);
- expect(screen.getByRole('form')).toBeInTheDocument();
- expect(screen.getAllByRole('img').length).toBe(1);
+ expect(await screen.findByRole('form')).toBeInTheDocument();
+ expect((await screen.findAllByRole('img')).length).toBe(1);
});
-test('renders tooltip icon', () => {
+test('renders tooltip icon', async () => {
render(
,
);
- expect(screen.getAllByRole('img').length).toBe(2);
+ expect((await screen.findAllByRole('img')).length).toBe(2);
});
test('renders a tooltip when hovered', async () => {
@@ -50,13 +50,13 @@ test('renders a tooltip when hovered', async () => {
expect(await screen.findByRole('tooltip')).toBeInTheDocument();
});
-test('calls onSelect when clicked', () => {
+test('calls onSelect when clicked', async () => {
const onSelect = jest.fn();
render(
,
);
- userEvent.click(screen.getByRole('img'));
+ userEvent.click(await screen.findByRole('img'));
expect(onSelect).toHaveBeenCalled();
});