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 2023/02/03 13:26:02 UTC
[superset] branch master updated: test: Fix act errors in DatabaseList test (#22970)
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 39f15b8d95 test: Fix act errors in DatabaseList test (#22970)
39f15b8d95 is described below
commit 39f15b8d95cea0d810a050c39749b4ea0548d47d
Author: Lyndsi Kay Williams <55...@users.noreply.github.com>
AuthorDate: Fri Feb 3 07:25:52 2023 -0600
test: Fix act errors in DatabaseList test (#22970)
---
.../views/CRUD/data/database/DatabaseList.test.jsx | 28 +++++++++++++++-------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
index d30dbce6e5..5710d6dd0d 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
@@ -64,6 +64,14 @@ jest.mock('react-redux', () => ({
useSelector: jest.fn(),
}));
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({ fileName, role }) => (
+ <span role={role ?? 'img'} aria-label={fileName.replace('_', '-')} />
+ ),
+ StyledIcon: () => <span />,
+}));
+
fetchMock.get(databasesInfoEndpoint, {
permissions: ['can_write'],
});
@@ -131,27 +139,27 @@ describe('Admin DatabaseList', () => {
await waitForComponentToPaint(wrapper);
});
- it('renders', () => {
+ test('renders', () => {
expect(wrapper.find(DatabaseList)).toExist();
});
- it('renders a SubMenu', () => {
+ test('renders a SubMenu', () => {
expect(wrapper.find(SubMenu)).toExist();
});
- it('renders a SubMenu with no tabs', () => {
+ test('renders a SubMenu with no tabs', () => {
expect(wrapper.find(SubMenu).props().tabs).toBeUndefined();
});
- it('renders a DatabaseModal', () => {
+ test('renders a DatabaseModal', () => {
expect(wrapper.find(DatabaseModal)).toExist();
});
- it('renders a ListView', () => {
+ test('renders a ListView', () => {
expect(wrapper.find(ListView)).toExist();
});
- it('fetches Databases', () => {
+ test('fetches Databases', () => {
const callsD = fetchMock.calls(/database\/\?q/);
expect(callsD).toHaveLength(2);
expect(callsD[0][0]).toMatchInlineSnapshot(
@@ -159,7 +167,7 @@ describe('Admin DatabaseList', () => {
);
});
- it('deletes', async () => {
+ test('deletes', async () => {
act(() => {
wrapper.find('[data-test="database-delete"]').first().props().onClick();
});
@@ -189,7 +197,7 @@ describe('Admin DatabaseList', () => {
expect(fetchMock.calls(/database\/0/, 'DELETE')).toHaveLength(1);
});
- it('filters', async () => {
+ test('filters', async () => {
const filtersWrapper = wrapper.find(Filters);
act(() => {
filtersWrapper
@@ -217,7 +225,7 @@ describe('Admin DatabaseList', () => {
);
});
- it('should not render dropdown menu button if user is not admin', () => {
+ test('should not render dropdown menu button if user is not admin', async () => {
userSelectorMock.mockReturnValue({
createdOn: '2021-05-27T18:12:38.952304',
email: 'alpha@gmail.com',
@@ -240,6 +248,8 @@ describe('Admin DatabaseList', () => {
<DatabaseList />
</Provider>,
);
+ await waitForComponentToPaint(newWrapper);
+
expect(newWrapper.find('.dropdown-menu-links')).not.toExist();
});
});