fix: clean up prop type errors in jest tests (#11120)

This commit is contained in:
Elizabeth Thompson 2020-10-02 14:59:04 -07:00 committed by GitHub
parent 662fb43350
commit d95b7c2a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 55 additions and 14 deletions

View File

@ -22,14 +22,25 @@ import { SuperChart } from '@superset-ui/core';
import ChartRenderer from 'src/chart/ChartRenderer';
const requiredProps = {
chartId: 1,
datasource: {},
formData: {},
vizType: 'foo',
};
describe('ChartRenderer', () => {
it('should render SuperChart', () => {
const wrapper = shallow(<ChartRenderer refreshOverlayVisible={false} />);
const wrapper = shallow(
<ChartRenderer {...requiredProps} refreshOverlayVisible={false} />,
);
expect(wrapper.find(SuperChart)).toExist();
});
it('should not render SuperChart when refreshOverlayVisible is true', () => {
const wrapper = shallow(<ChartRenderer refreshOverlayVisible />);
const wrapper = shallow(
<ChartRenderer {...requiredProps} refreshOverlayVisible />,
);
expect(wrapper.find(SuperChart)).not.toExist();
});
});

View File

@ -28,6 +28,7 @@ describe('URLShortLinkModal', () => {
url: 'mockURL',
emailSubject: 'Mock Subject',
emailContent: 'mock content',
triggerNode: <div />,
};
function setup() {

View File

@ -67,6 +67,7 @@ describe('DashboardBuilder', () => {
colorScheme: undefined,
handleComponentDrop() {},
setDirectPathToChild: sinon.spy(),
setMountedTab() {},
};
function setup(overrideProps, useProvider = false, store = mockStore) {

View File

@ -32,6 +32,13 @@ describe('FilterIndicatorGroup', () => {
colorCode: 'badge-1',
name: column,
values: ['a', 'b', 'c'],
isFilterFieldActive: true,
chartId: 1,
componentId: 'foo',
directPathToFilter: ['foo'],
isDateFilter: false,
isInstantFilter: false,
label: 'foo',
},
],
setDirectPathToChild: () => {},

View File

@ -32,6 +32,11 @@ describe('FilterIndicator', () => {
name: column,
label: column,
values: ['a', 'b', 'c'],
chartId: 1,
componentId: 'foo',
isDateFilter: false,
isFilterFieldActive: true,
isInstantFilter: false,
},
setDirectPathToChild: jest.fn(),
};

View File

@ -29,21 +29,27 @@ describe('HeaderActionsDropdown', () => {
const props = {
addSuccessToast: () => {},
addDangerToast: () => {},
dashboardId: 1,
dashboardTitle: 'Title',
hasUnsavedChanges: false,
customCss: '',
onChange: () => {},
updateCss: () => {},
forceRefreshAllCharts: () => {},
startPeriodicRender: () => {},
dashboardId: 1,
dashboardInfo: {},
dashboardTitle: 'Title',
editMode: false,
expandedSlices: {},
filters: {},
forceRefreshAllCharts: () => {},
hasUnsavedChanges: false,
isLoading: false,
layout: {},
onChange: () => {},
onSave: () => {},
refreshFrequency: 200,
setRefreshFrequency: () => {},
shouldPersistRefreshFrequency: true,
showPropertiesModal: () => {},
startPeriodicRender: () => {},
updateCss: () => {},
userCanEdit: false,
userCanSave: false,
layout: {},
filters: {},
expandedSlices: {},
onSave: () => {},
};
function setup(overrideProps) {

View File

@ -51,6 +51,7 @@ function setup(overrides) {
adhocMetric: sumValueAdhocMetric,
onChange,
onClose,
onResize: () => {},
columns,
...overrides,
};

View File

@ -34,6 +34,7 @@ describe('DisplayQueryButton', () => {
latestQueryFormData: {
datasource: '1__table',
},
chartHeight: '30px',
};
it('is valid', () => {

View File

@ -26,6 +26,7 @@ describe('ExploreActionButtons', () => {
canDownload: 'True',
latestQueryFormData: {},
queryEndpoint: 'localhost',
chartHeight: '30px',
};
it('renders', () => {

View File

@ -25,6 +25,12 @@ describe('ChartContainer', () => {
sliceName: 'Trend Line',
vizType: 'line',
height: '500px',
actions: {},
can_overwrite: false,
can_download: false,
containerId: 'foo',
width: '50px',
isStarred: false,
};
it('renders when vizType is line', () => {

View File

@ -25,7 +25,7 @@ import Button from 'src/components/Button';
describe('QueryAndSaveButtons', () => {
const defaultProps = {
canAdd: 'True',
canAdd: true,
onQuery: sinon.spy(),
};

View File

@ -29,6 +29,7 @@ describe('QuerySearch', () => {
const mockedProps = {
actions: {},
height: 0,
displayLimit: 50,
};
it('is valid', () => {
expect(React.isValidElement(<QuerySearch {...mockedProps} />)).toBe(true);