Eslint prefer-object-spread (#9466)

* The rule.

* The result
This commit is contained in:
Evan Rusackas
2020-04-03 17:05:16 -07:00
committed by GitHub
parent 265a2feb29
commit 1cdfb829d7
29 changed files with 211 additions and 266 deletions

View File

@@ -38,15 +38,9 @@ describe('ResultSet', () => {
query: queries[0],
height: 0,
};
const stoppedQueryProps = Object.assign({}, mockedProps, {
query: stoppedQuery,
});
const runningQueryProps = Object.assign({}, mockedProps, {
query: runningQuery,
});
const cachedQueryProps = Object.assign({}, mockedProps, {
query: cachedQuery,
});
const stoppedQueryProps = { ...mockedProps, query: stoppedQuery };
const runningQueryProps = { ...mockedProps, query: runningQuery };
const cachedQueryProps = { ...mockedProps, query: cachedQuery };
const newProps = {
query: {
cached: false,
@@ -94,11 +88,12 @@ describe('ResultSet', () => {
});
it('should render empty results', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
const emptyResults = Object.assign({}, queries[0], {
const emptyResults = {
...queries[0],
results: {
data: [],
},
});
};
wrapper.setProps({ query: emptyResults });
expect(wrapper.find(FilterableTable)).toHaveLength(0);
expect(wrapper.find(Alert)).toHaveLength(1);

View File

@@ -37,10 +37,7 @@ describe('TabbedSqlEditors', () => {
const tabHistory = ['dfsadfs', 'newEditorId'];
const tables = [
Object.assign({}, table, {
dataPreviewQueryId: 'B1-VQU1zW',
queryEditorId: 'newEditorId',
}),
{ ...table, dataPreviewQueryId: 'B1-VQU1zW', queryEditorId: 'newEditorId' },
];
const queryEditors = [

View File

@@ -19,7 +19,7 @@
import sinon from 'sinon';
import * as actions from '../../../src/SqlLab/actions/sqlLab';
export const mockedActions = sinon.stub(Object.assign({}, actions));
export const mockedActions = sinon.stub({ ...actions });
export const alert = { bsStyle: 'danger', msg: 'Ooops', id: 'lksvmcx32' };
export const table = {
@@ -388,7 +388,7 @@ export const runningQuery = {
state: 'running',
startDttm: Date.now() - 500,
};
export const cachedQuery = Object.assign({}, queries[0], { cached: true });
export const cachedQuery = { ...queries[0], cached: true };
export const initialState = {
sqlLab: {

View File

@@ -141,7 +141,7 @@ describe('sqlLabReducer', () => {
let newState;
let newTable;
beforeEach(() => {
newTable = Object.assign({}, table);
newTable = { ...table };
const action = {
type: actions.MERGE_TABLE,
table: newTable,