Re-enable rule prefer-destructuring (only for objects) (#10867)

This commit is contained in:
Kamil Gabryjelski
2020-09-14 19:11:20 +02:00
committed by GitHub
parent c51168a30a
commit 352e8a1afd
53 changed files with 80 additions and 83 deletions

View File

@@ -41,7 +41,7 @@ describe('CollectionTable', () => {
});
it('renders a table', () => {
const length = mockDatasource['7__table'].columns.length;
const { length } = mockDatasource['7__table'].columns;
expect(wrapper.find('table')).toExist();
expect(wrapper.find('tbody tr.row')).toHaveLength(length);
});

View File

@@ -103,7 +103,7 @@ describe('dashboardState actions', () => {
const thunk = saveDashboardRequest(newDashboardData, 1, 'save_dash');
thunk(dispatch, getState);
expect(postStub.callCount).toBe(1);
const postPayload = postStub.getCall(0).args[0].postPayload;
const { postPayload } = postStub.getCall(0).args[0];
expect(postPayload.data.positions[DASHBOARD_GRID_ID].parents).toBe(
mockParentsList,
);

View File

@@ -39,7 +39,7 @@ import {
import { filterComponent } from '../fixtures/mockDashboardLayout';
describe('dashboardFilters reducer', () => {
const form_data = sliceEntitiesForDashboard.slices[filterId].form_data;
const { form_data } = sliceEntitiesForDashboard.slices[filterId];
const component = filterComponent;
const directPathToFilter = (component.parents || []).slice();
directPathToFilter.push(component.id);

View File

@@ -158,7 +158,7 @@ describe('SaveModal', () => {
it('should save slice', () => {
const wrapper = getWrapper();
wrapper.instance().saveOrOverwrite(true);
const args = defaultProps.actions.saveSlice.getCall(0).args;
const { args } = defaultProps.actions.saveSlice.getCall(0);
expect(args[0]).toEqual(defaultProps.form_data);
});
@@ -168,7 +168,7 @@ describe('SaveModal', () => {
wrapper.setState({ saveToDashboardId });
wrapper.instance().saveOrOverwrite(true);
const args = defaultProps.actions.saveSlice.getCall(0).args;
const { args } = defaultProps.actions.saveSlice.getCall(0);
expect(args[1].save_to_dashboard_id).toBe(saveToDashboardId);
});
@@ -178,7 +178,7 @@ describe('SaveModal', () => {
wrapper.setState({ newDashboardName });
wrapper.instance().saveOrOverwrite(true);
const args = defaultProps.actions.saveSlice.getCall(0).args;
const { args } = defaultProps.actions.saveSlice.getCall(0);
expect(args[1].new_dashboard_name).toBe(newDashboardName);
});

View File

@@ -33,7 +33,7 @@ import * as hostNamesConfig from 'src/utils/hostNamesConfig';
import { getChartMetadataRegistry } from '@superset-ui/core';
describe('exploreUtils', () => {
const location = window.location;
const { location } = window;
const formData = {
datasource: '1__table',
};

View File

@@ -81,7 +81,7 @@ describe('logger middleware', () => {
clock.tick(2000);
expect(SupersetClient.post.callCount).toBe(1);
const events = SupersetClient.post.getCall(0).args[0].postPayload.events;
const { events } = SupersetClient.post.getCall(0).args[0].postPayload;
const mockEventdata = action.payload.eventData;
const mockEventname = action.payload.eventName;
expect(events[0]).toMatchObject({

View File

@@ -69,7 +69,7 @@ describe('QuerySearch', () => {
});
it('refreshes queries when enter (only) is pressed on the input', () => {
const callCount = search.callCount;
const { callCount } = search;
wrapper.find('input').simulate('keyDown', { keyCode: 'a'.charCodeAt(0) });
expect(search.callCount).toBe(callCount);
wrapper.find('input').simulate('keyDown', { keyCode: '\r'.charCodeAt(0) });
@@ -81,7 +81,7 @@ describe('QuerySearch', () => {
});
it('refreshes queries when clicked', () => {
const callCount = search.callCount;
const { callCount } = search;
wrapper.find(Button).simulate('click');
expect(search.callCount).toBe(callCount + 1);
});