mirror of
https://github.com/apache/superset.git
synced 2026-04-27 12:05:24 +00:00
chore: Use queryEditorId in SqlEditor child components (#21650)
This commit is contained in:
@@ -17,22 +17,24 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { mount } from 'enzyme';
|
||||
import { Provider } from 'react-redux';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import thunk from 'redux-thunk';
|
||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
import Collapse from 'src/components/Collapse';
|
||||
import { IconTooltip } from 'src/components/IconTooltip';
|
||||
import TableElement from 'src/SqlLab/components/TableElement';
|
||||
import ColumnElement from 'src/SqlLab/components/ColumnElement';
|
||||
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
||||
import { mockedActions, table } from 'src/SqlLab/fixtures';
|
||||
import { initialState, table } from 'src/SqlLab/fixtures';
|
||||
|
||||
const middlewares = [thunk];
|
||||
const mockStore = configureStore(middlewares);
|
||||
|
||||
describe('TableElement', () => {
|
||||
const mockStore = configureStore([]);
|
||||
const store = mockStore({});
|
||||
const store = mockStore(initialState);
|
||||
const mockedProps = {
|
||||
actions: mockedActions,
|
||||
table,
|
||||
timeout: 0,
|
||||
};
|
||||
@@ -57,7 +59,17 @@ describe('TableElement', () => {
|
||||
expect(wrapper.find(IconTooltip)).toHaveLength(4);
|
||||
});
|
||||
it('has 14 columns', () => {
|
||||
const wrapper = shallow(<TableElement {...mockedProps} />);
|
||||
const wrapper = mount(
|
||||
<Provider store={store}>
|
||||
<TableElement {...mockedProps} />
|
||||
</Provider>,
|
||||
{
|
||||
wrappingComponent: ThemeProvider,
|
||||
wrappingComponentProps: {
|
||||
theme: supersetTheme,
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(wrapper.find(ColumnElement)).toHaveLength(14);
|
||||
});
|
||||
it('mounts', () => {
|
||||
@@ -143,6 +155,7 @@ describe('TableElement', () => {
|
||||
},
|
||||
);
|
||||
wrapper.find('.table-remove').hostNodes().simulate('click');
|
||||
expect(mockedActions.removeDataPreview.called).toBe(true);
|
||||
expect(store.getActions()).toHaveLength(1);
|
||||
expect(store.getActions()[0].type).toEqual('REMOVE_DATA_PREVIEW');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user