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/08 18:53:22 UTC

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

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

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

commit 6b1489b3fb084d724c08fefe99b31868b0eb8802
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Sep 8 13:52:45 2022 -0500

    6 act errors removed from SubMenu test
---
 .../src/views/components/SubMenu.test.tsx          | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/superset-frontend/src/views/components/SubMenu.test.tsx b/superset-frontend/src/views/components/SubMenu.test.tsx
index 6359e03cc2..6365f9a8c6 100644
--- a/superset-frontend/src/views/components/SubMenu.test.tsx
+++ b/superset-frontend/src/views/components/SubMenu.test.tsx
@@ -45,7 +45,7 @@ const mockedProps = {
   ],
   dropDownLinks: [
     {
-      label: 'test a upload',
+      label: 'test an upload',
       childs: [
         {
           label: 'Upload Test',
@@ -58,29 +58,31 @@ const mockedProps = {
   ],
 };
 
-test('should render', () => {
+test('should render', async () => {
   const { container } = render(<SubMenu {...mockedProps} />);
+  expect(await screen.findByText(/title/i)).toBeInTheDocument();
   expect(container).toBeInTheDocument();
 });
 
-test('should render the navigation', () => {
+test('should render the navigation', async () => {
   render(<SubMenu {...mockedProps} />);
-  expect(screen.getByRole('navigation')).toBeInTheDocument();
+  expect(await screen.findByRole('navigation')).toBeInTheDocument();
 });
 
-test('should render the brand', () => {
+test('should render the brand', async () => {
   render(<SubMenu {...mockedProps} />);
-  expect(screen.getByText('Title')).toBeInTheDocument();
+  expect(await screen.findByText('Title')).toBeInTheDocument();
 });
 
-test('should render the right number of tabs', () => {
+test('should render the right number of tabs', async () => {
   render(<SubMenu {...mockedProps} />);
-  expect(screen.getAllByRole('tab')).toHaveLength(3);
+  expect(await screen.findAllByRole('tab')).toHaveLength(3);
 });
 
-test('should render all the tabs links', () => {
+test('should render all the tabs links', async () => {
   const { tabs } = mockedProps;
   render(<SubMenu {...mockedProps} />);
+  expect(await screen.findAllByRole('tab')).toHaveLength(3);
   tabs.forEach(tab => {
     const tabItem = screen.getByText(tab.label);
     expect(tabItem).toHaveAttribute('href', tab.url);
@@ -89,12 +91,12 @@ test('should render all the tabs links', () => {
 
 test('should render dropdownlinks', async () => {
   render(<SubMenu {...mockedProps} />);
-  userEvent.hover(screen.getByText('test a upload'));
-  const label = await screen.findByText('test a upload');
+  userEvent.hover(screen.getByText('test an upload'));
+  const label = await screen.findByText('test an upload');
   expect(label).toBeInTheDocument();
 });
 
-test('should render the buttons', () => {
+test('should render the buttons', async () => {
   const mockFunc = jest.fn();
   const buttons = [
     {
@@ -114,7 +116,7 @@ test('should render the buttons', () => {
   };
   render(<SubMenu {...buttonsProps} />);
   const testButton = screen.getByText(buttons[0].name);
-  expect(screen.getAllByRole('button')).toHaveLength(3);
+  expect(await screen.findAllByRole('button')).toHaveLength(3);
   userEvent.click(testButton);
   expect(mockFunc).toHaveBeenCalled();
 });