chore: Moves spec files to the src folder - iteration 10 (#17902)

* chore: Moves spec files to the src folder - iteration 10

* Fixes test

* Fixes lint problem

* Uses styledMount in test
This commit is contained in:
Michael S. Molina 2022-01-07 15:24:15 -03:00 committed by GitHub
parent bb7e979142
commit 647bbf1ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 11 additions and 9 deletions

View File

@ -17,11 +17,16 @@
* under the License. * under the License.
*/ */
import React from 'react'; import React from 'react';
import { mount, shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { supersetTheme, ThemeProvider } from '@superset-ui/core'; import { styledMount as mount } from 'spec/helpers/theming';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import { Dropdown, Menu } from 'src/common/components'; import { Dropdown, Menu } from 'src/common/components';
import ExploreAdditionalActionsMenu from 'src/explore/components/ExploreAdditionalActionsMenu'; import ExploreAdditionalActionsMenu from 'src/explore/components/ExploreAdditionalActionsMenu';
const mockStore = configureStore([thunk]);
const store = mockStore({});
describe('ExploreAdditionalActionsMenu', () => { describe('ExploreAdditionalActionsMenu', () => {
const defaultProps = { const defaultProps = {
animation: false, animation: false,
@ -43,12 +48,9 @@ describe('ExploreAdditionalActionsMenu', () => {
).toBe(true); ).toBe(true);
}); });
it('renders a dropdown with 3 items', () => { it('renders a dropdown with 3 items', () => {
const wrapper = mount(<ExploreAdditionalActionsMenu {...defaultProps} />, { const wrapper = mount(
wrappingComponent: ThemeProvider, <ExploreAdditionalActionsMenu store={store} {...defaultProps} />,
wrappingComponentProps: { );
theme: supersetTheme,
},
});
const dropdown = wrapper.find(Dropdown); const dropdown = wrapper.find(Dropdown);
const menu = shallow(<div>{dropdown.prop('overlay')}</div>); const menu = shallow(<div>{dropdown.prop('overlay')}</div>);
const menuItems = menu.find(Menu.Item); const menuItems = menu.find(Menu.Item);

View File

@ -33,7 +33,7 @@ import {
controlPanelSectionsChartOptions, controlPanelSectionsChartOptions,
controlPanelSectionsChartOptionsOnlyColorScheme, controlPanelSectionsChartOptionsOnlyColorScheme,
controlPanelSectionsChartOptionsTable, controlPanelSectionsChartOptionsTable,
} from 'spec/javascripts/explore/fixtures'; } from 'src/explore/fixtures';
const getKnownControlConfig = (controlKey: string, vizType: string) => const getKnownControlConfig = (controlKey: string, vizType: string) =>
getControlConfig(controlKey, vizType) as ControlConfig; getControlConfig(controlKey, vizType) as ControlConfig;