From d95b7c2a73ecd0bf0f44434d80ab8496d9cb6311 Mon Sep 17 00:00:00 2001 From: Elizabeth Thompson Date: Fri, 2 Oct 2020 14:59:04 -0700 Subject: [PATCH] fix: clean up prop type errors in jest tests (#11120) --- .../javascripts/chart/ChartRenderer_spec.jsx | 15 ++++++++-- .../components/URLShortLinkModal_spec.jsx | 1 + .../components/DashboardBuilder_spec.jsx | 1 + .../components/FilterIndicatorGroup_spec.jsx | 7 +++++ .../components/FilterIndicator_spec.jsx | 5 ++++ .../components/HeaderActionsDropdown_spec.jsx | 28 +++++++++++-------- .../AdhocMetricEditPopover_spec.jsx | 1 + .../components/DisplayQueryButton_spec.jsx | 1 + .../components/ExploreActionButtons_spec.jsx | 1 + .../components/ExploreChartPanel_spec.jsx | 6 ++++ .../components/QueryAndSaveBtns_spec.jsx | 2 +- .../javascripts/sqllab/QuerySearch_spec.jsx | 1 + 12 files changed, 55 insertions(+), 14 deletions(-) diff --git a/superset-frontend/spec/javascripts/chart/ChartRenderer_spec.jsx b/superset-frontend/spec/javascripts/chart/ChartRenderer_spec.jsx index 51fe073053..609b54b6d1 100644 --- a/superset-frontend/spec/javascripts/chart/ChartRenderer_spec.jsx +++ b/superset-frontend/spec/javascripts/chart/ChartRenderer_spec.jsx @@ -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(); + const wrapper = shallow( + , + ); expect(wrapper.find(SuperChart)).toExist(); }); it('should not render SuperChart when refreshOverlayVisible is true', () => { - const wrapper = shallow(); + const wrapper = shallow( + , + ); expect(wrapper.find(SuperChart)).not.toExist(); }); }); diff --git a/superset-frontend/spec/javascripts/components/URLShortLinkModal_spec.jsx b/superset-frontend/spec/javascripts/components/URLShortLinkModal_spec.jsx index 163b321bed..2b687844df 100644 --- a/superset-frontend/spec/javascripts/components/URLShortLinkModal_spec.jsx +++ b/superset-frontend/spec/javascripts/components/URLShortLinkModal_spec.jsx @@ -28,6 +28,7 @@ describe('URLShortLinkModal', () => { url: 'mockURL', emailSubject: 'Mock Subject', emailContent: 'mock content', + triggerNode:
, }; function setup() { diff --git a/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx index 82211c4cae..98ad189007 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx @@ -67,6 +67,7 @@ describe('DashboardBuilder', () => { colorScheme: undefined, handleComponentDrop() {}, setDirectPathToChild: sinon.spy(), + setMountedTab() {}, }; function setup(overrideProps, useProvider = false, store = mockStore) { diff --git a/superset-frontend/spec/javascripts/dashboard/components/FilterIndicatorGroup_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/FilterIndicatorGroup_spec.jsx index bf78d23e2d..58ead02c0f 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/FilterIndicatorGroup_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/FilterIndicatorGroup_spec.jsx @@ -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: () => {}, diff --git a/superset-frontend/spec/javascripts/dashboard/components/FilterIndicator_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/FilterIndicator_spec.jsx index 17da99211e..f80b4620f9 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/FilterIndicator_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/FilterIndicator_spec.jsx @@ -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(), }; diff --git a/superset-frontend/spec/javascripts/dashboard/components/HeaderActionsDropdown_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/HeaderActionsDropdown_spec.jsx index d1e19623fa..033e801bc5 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/HeaderActionsDropdown_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/HeaderActionsDropdown_spec.jsx @@ -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) { diff --git a/superset-frontend/spec/javascripts/explore/components/AdhocMetricEditPopover_spec.jsx b/superset-frontend/spec/javascripts/explore/components/AdhocMetricEditPopover_spec.jsx index 2f15017c7b..b08b1d389b 100644 --- a/superset-frontend/spec/javascripts/explore/components/AdhocMetricEditPopover_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/AdhocMetricEditPopover_spec.jsx @@ -51,6 +51,7 @@ function setup(overrides) { adhocMetric: sumValueAdhocMetric, onChange, onClose, + onResize: () => {}, columns, ...overrides, }; diff --git a/superset-frontend/spec/javascripts/explore/components/DisplayQueryButton_spec.jsx b/superset-frontend/spec/javascripts/explore/components/DisplayQueryButton_spec.jsx index 4885266b54..4e75cda0b9 100644 --- a/superset-frontend/spec/javascripts/explore/components/DisplayQueryButton_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/DisplayQueryButton_spec.jsx @@ -34,6 +34,7 @@ describe('DisplayQueryButton', () => { latestQueryFormData: { datasource: '1__table', }, + chartHeight: '30px', }; it('is valid', () => { diff --git a/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx b/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx index 6a8b6e0993..9e07f0e400 100644 --- a/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx @@ -26,6 +26,7 @@ describe('ExploreActionButtons', () => { canDownload: 'True', latestQueryFormData: {}, queryEndpoint: 'localhost', + chartHeight: '30px', }; it('renders', () => { diff --git a/superset-frontend/spec/javascripts/explore/components/ExploreChartPanel_spec.jsx b/superset-frontend/spec/javascripts/explore/components/ExploreChartPanel_spec.jsx index f05c304be0..c50a605a40 100644 --- a/superset-frontend/spec/javascripts/explore/components/ExploreChartPanel_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/ExploreChartPanel_spec.jsx @@ -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', () => { diff --git a/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx b/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx index 7c32361233..6410d7fe79 100644 --- a/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx @@ -25,7 +25,7 @@ import Button from 'src/components/Button'; describe('QueryAndSaveButtons', () => { const defaultProps = { - canAdd: 'True', + canAdd: true, onQuery: sinon.spy(), }; diff --git a/superset-frontend/spec/javascripts/sqllab/QuerySearch_spec.jsx b/superset-frontend/spec/javascripts/sqllab/QuerySearch_spec.jsx index 3e6945f153..d8739c5f81 100644 --- a/superset-frontend/spec/javascripts/sqllab/QuerySearch_spec.jsx +++ b/superset-frontend/spec/javascripts/sqllab/QuerySearch_spec.jsx @@ -29,6 +29,7 @@ describe('QuerySearch', () => { const mockedProps = { actions: {}, height: 0, + displayLimit: 50, }; it('is valid', () => { expect(React.isValidElement()).toBe(true);