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/07 21:21:41 UTC

[superset] branch lyndsi/sqleditorleftbar-act-cleanup created (now 26224781b1)

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

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


      at 26224781b1 12 act errors removed from SqlEditorLeftBar test

This branch includes the following new commits:

     new 26224781b1 12 act errors removed from SqlEditorLeftBar test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: 12 act errors removed from SqlEditorLeftBar test

Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 26224781b1d2d7cf0762e07edd04f7d1b93f1572
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Wed Sep 7 16:21:13 2022 -0500

    12 act errors removed from SqlEditorLeftBar test
---
 .../SqlEditorLeftBar/SqlEditorLeftBar.test.jsx     | 110 +++++++++++----------
 1 file changed, 57 insertions(+), 53 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx
index 79e7793421..9d32454899 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx
@@ -25,7 +25,6 @@ import { Provider } from 'react-redux';
 import '@testing-library/jest-dom/extend-expect';
 import thunk from 'redux-thunk';
 import SqlEditorLeftBar from 'src/SqlLab/components/SqlEditorLeftBar';
-import { supersetTheme, ThemeProvider } from '@superset-ui/core';
 import {
   table,
   initialState,
@@ -59,7 +58,7 @@ fetchMock.get('glob:*/superset/tables/**', {
 });
 
 describe('Left Panel Expansion', () => {
-  it('is valid', () => {
+  test('is valid', () => {
     expect(
       React.isValidElement(
         <Provider store={store}>
@@ -69,61 +68,66 @@ describe('Left Panel Expansion', () => {
     ).toBe(true);
   });
 
-  it('renders a TableElement', () => {
-    const { queryAllByTestId } = render(
-      <ThemeProvider theme={supersetTheme}>
-        <Provider store={store}>
-          <SqlEditorLeftBar {...mockedProps} />
-        </Provider>
-      </ThemeProvider>,
-    );
-    expect(queryAllByTestId('table-element').length).toBeGreaterThanOrEqual(1);
+  test('renders a TableElement', async () => {
+    render(<SqlEditorLeftBar {...mockedProps} />, {
+      useRedux: true,
+      initialState,
+    });
+
+    expect(
+      await screen.findByText(/select database or type database name/i),
+    ).toBeInTheDocument();
+    expect(
+      screen.queryAllByTestId('table-element').length,
+    ).toBeGreaterThanOrEqual(1);
   });
 
-  describe('Left Panel Expansion', () => {
-    it('table should be visible when expanded is true', () => {
-      const { container } = render(
-        <ThemeProvider theme={supersetTheme}>
-          <Provider store={store}>
-            <SqlEditorLeftBar {...mockedProps} />
-          </Provider>
-        </ThemeProvider>,
-      );
-      const dbSelect = screen.getByRole('combobox', {
-        name: 'Select database or type database name',
-      });
-      const schemaSelect = screen.getByRole('combobox', {
-        name: 'Select schema or type schema name',
-      });
-      const dropdown = screen.getByText(/Select table or type table name/i);
-      const abUser = screen.getByText(/ab_user/i);
-      expect(dbSelect).toBeInTheDocument();
-      expect(schemaSelect).toBeInTheDocument();
-      expect(dropdown).toBeInTheDocument();
-      expect(abUser).toBeInTheDocument();
-      expect(
-        container.querySelector('.ant-collapse-content-active'),
-      ).toBeInTheDocument();
+  test('table should be visible when expanded is true', async () => {
+    const { container } = render(<SqlEditorLeftBar {...mockedProps} />, {
+      useRedux: true,
+      initialState,
     });
 
-    it('should toggle the table when the header is clicked', async () => {
-      const collapseMock = jest.fn();
-      render(
-        <ThemeProvider theme={supersetTheme}>
-          <Provider store={store}>
-            <SqlEditorLeftBar
-              actions={{ ...mockedActions, collapseTable: collapseMock }}
-              tables={[table]}
-              queryEditor={defaultQueryEditor}
-              database={databases}
-              height={0}
-            />
-          </Provider>
-        </ThemeProvider>,
-      );
-      const header = screen.getByText(/ab_user/);
-      userEvent.click(header);
-      expect(collapseMock).toHaveBeenCalled();
+    const dbSelect = screen.getByRole('combobox', {
+      name: 'Select database or type database name',
     });
+    const schemaSelect = screen.getByRole('combobox', {
+      name: 'Select schema or type schema name',
+    });
+    const dropdown = screen.getByText(/Select table or type table name/i);
+    const abUser = screen.getByText(/ab_user/i);
+
+    expect(
+      await screen.findByText(/select database or type database name/i),
+    ).toBeInTheDocument();
+    expect(dbSelect).toBeInTheDocument();
+    expect(schemaSelect).toBeInTheDocument();
+    expect(dropdown).toBeInTheDocument();
+    expect(abUser).toBeInTheDocument();
+    expect(
+      container.querySelector('.ant-collapse-content-active'),
+    ).toBeInTheDocument();
+  });
+
+  test('should toggle the table when the header is clicked', async () => {
+    const collapseMock = jest.fn();
+    render(
+      <SqlEditorLeftBar
+        actions={{ ...mockedActions, collapseTable: collapseMock }}
+        tables={[table]}
+        queryEditor={defaultQueryEditor}
+        database={databases}
+        height={0}
+      />,
+      {
+        useRedux: true,
+        initialState,
+      },
+    );
+
+    expect(await screen.findByText(/ab_user/)).toBeInTheDocument();
+    const header = screen.getByText(/ab_user/);
+    userEvent.click(header);
+    expect(collapseMock).toHaveBeenCalled();
   });
 });