chore: upgrade eslint, babel, and prettier (#12393)

This commit is contained in:
Jesse Yang
2021-01-10 17:26:35 -08:00
committed by GitHub
parent 6bee3a0581
commit 9acf48fd1e
69 changed files with 4563 additions and 1964 deletions

View File

@@ -62,8 +62,8 @@ describe('AsyncSelect', () => {
});
describe('auto select', () => {
it('should not call onChange if autoSelect=false', () => {
return new Promise(done => {
it('should not call onChange if autoSelect=false', () =>
new Promise(done => {
expect.assertions(2);
const onChangeSpy = jest.fn();
@@ -74,11 +74,10 @@ describe('AsyncSelect', () => {
expect(onChangeSpy.mock.calls).toHaveLength(0);
done();
});
});
});
}));
it('should auto select the first option if autoSelect=true', () => {
return new Promise(done => {
it('should auto select the first option if autoSelect=true', () =>
new Promise(done => {
expect.assertions(3);
const onChangeSpy = jest.fn();
@@ -94,11 +93,10 @@ describe('AsyncSelect', () => {
);
done();
});
});
});
}));
it('should not auto select when value prop is set and autoSelect=true', () => {
return new Promise(done => {
it('should not auto select when value prop is set and autoSelect=true', () =>
new Promise(done => {
expect.assertions(3);
const onChangeSpy = jest.fn();
@@ -117,8 +115,7 @@ describe('AsyncSelect', () => {
expect(wrapper.find(Select)).toExist();
done();
});
});
});
}));
it('should call onAsyncError if there is an error fetching options', () => {
expect.assertions(3);

View File

@@ -489,7 +489,7 @@ describe('dashboardLayout actions', () => {
});
describe('undoLayoutAction', () => {
it('should dispatch a redux-undo .undo() action ', () => {
it('should dispatch a redux-undo .undo() action', () => {
const { getState, dispatch } = setup({
dashboardLayout: { past: ['non-empty'] },
});
@@ -513,7 +513,7 @@ describe('dashboardLayout actions', () => {
});
describe('redoLayoutAction', () => {
it('should dispatch a redux-undo .redo() action ', () => {
it('should dispatch a redux-undo .redo() action', () => {
const { getState, dispatch } = setup();
const thunk = redoLayoutAction();
thunk(dispatch, getState);

View File

@@ -26,7 +26,7 @@ describe('FilterConfigurationButton', () => {
const mockedProps = {
createNewOnOpen: false,
};
it('it is valid', () => {
it('is valid', () => {
expect(
React.isValidElement(<FilterConfigurationLink {...mockedProps} />),
).toBe(true);

View File

@@ -64,8 +64,8 @@ describe('DatasourceEditor', () => {
expect(wrapper.find(Tabs)).toExist();
});
it('makes an async request', () => {
return new Promise(done => {
it('makes an async request', () =>
new Promise(done => {
wrapper.setState({ activeTabKey: 2 });
const syncButton = wrapper.find('.sync-from-source');
expect(syncButton).toHaveLength(1);
@@ -76,8 +76,7 @@ describe('DatasourceEditor', () => {
fetchMock.reset();
done();
}, 0);
});
});
}));
it('to add, remove and modify columns accordingly', () => {
const columns = [

View File

@@ -201,8 +201,8 @@ describe('SaveModal', () => {
Object.defineProperty(window, 'location', windowLocation);
});
it('Save & go to dashboard', () => {
return new Promise(done => {
it('Save & go to dashboard', () =>
new Promise(done => {
wrapper.instance().saveOrOverwrite(true);
defaultProps.actions.saveSlice().then(() => {
expect(window.location.assign.callCount).toEqual(1);
@@ -211,11 +211,10 @@ describe('SaveModal', () => {
);
done();
});
});
});
}));
it('saveas new slice', () => {
return new Promise(done => {
it('saveas new slice', () =>
new Promise(done => {
wrapper.setState({
action: 'saveas',
newSliceName: 'new slice name',
@@ -228,11 +227,10 @@ describe('SaveModal', () => {
);
done();
});
});
});
}));
it('overwrite original slice', () => {
return new Promise(done => {
it('overwrite original slice', () =>
new Promise(done => {
wrapper.setState({ action: 'overwrite' });
wrapper.instance().saveOrOverwrite(false);
defaultProps.actions.saveSlice().then(() => {
@@ -242,8 +240,7 @@ describe('SaveModal', () => {
);
done();
});
});
});
}));
});
});

View File

@@ -57,9 +57,9 @@ const defaultProps = {
function verify(sourceProp: string) {
const mock = jest.fn();
mock.mockImplementation(async (props: ControlPropsWithExtras) => {
return { [sourceProp]: props.validMetrics || [VALID_METRIC] };
});
mock.mockImplementation(async (props: ControlPropsWithExtras) => ({
[sourceProp]: props.validMetrics || [VALID_METRIC],
}));
return mock;
}

View File

@@ -43,8 +43,8 @@ describe('Toast', () => {
expect(alert.childAt(0).childAt(1).text()).toBe(props.toast.text);
});
it('should call onCloseToast upon alert dismissal', () => {
return new Promise(done => {
it('should call onCloseToast upon alert dismissal', () =>
new Promise(done => {
const onCloseToast = id => {
expect(id).toBe(props.toast.id);
done();
@@ -57,6 +57,5 @@ describe('Toast', () => {
const alertProps = wrapper.find(Alert).props();
expect(alertProps.onDismiss).toBe(handleClosePress);
handleClosePress(); // there is a timeout for onCloseToast to be called
});
});
}));
});

View File

@@ -50,7 +50,7 @@ describe('SaveDatasetModal', () => {
const wrapper = shallow(<SaveDatasetModal {...mockedProps} />);
expect(wrapper.find(AutoComplete)).toExist();
});
it('renders an input form ', () => {
it('renders an input form', () => {
// @ts-ignore
const wrapper = shallow(<SaveDatasetModal {...mockedProps} />);
expect(wrapper.find(Input)).toExist();

View File

@@ -86,7 +86,7 @@ describe('sqlLabReducer', () => {
newState = sqlLabReducer(newState, action);
expect(newState.queryEditors[1].schema).toBe(schema);
});
it('should not fail while setting autorun ', () => {
it('should not fail while setting autorun', () => {
const action = {
type: actions.QUERY_EDITOR_SET_AUTORUN,
queryEditor: qe,

View File

@@ -21,9 +21,7 @@ import parseCookie from 'src/utils/parseCookie';
describe('parseCookie', () => {
let cookieVal = '';
Object.defineProperty(document, 'cookie', {
get: jest.fn().mockImplementation(() => {
return cookieVal;
}),
get: jest.fn().mockImplementation(() => cookieVal),
});
it('parses cookie strings', () => {
cookieVal = 'val1=foo; val2=bar';

View File

@@ -70,13 +70,13 @@ describe('ActivityTable', () => {
await waitForComponentToPaint(wrapper);
});
it('the component renders ', () => {
it('the component renders', () => {
expect(wrapper.find(ActivityTable)).toExist();
});
it('renders tabs with three buttons', () => {
expect(wrapper.find('li')).toHaveLength(3);
});
it('it renders ActivityCards', async () => {
it('renders ActivityCards', async () => {
expect(wrapper.find('ListViewCard')).toExist();
});
});

View File

@@ -58,11 +58,11 @@ describe('ChartTable', () => {
},
};
const wrapper = mount(<ChartTable store={store} {...mockedProps} />);
it('it renders', () => {
it('renders', () => {
expect(wrapper.find(ChartTable)).toExist();
});
it('fetches chart favorites and renders chart cards ', async () => {
it('fetches chart favorites and renders chart cards', async () => {
act(() => {
const handler = wrapper.find('li.no-router a').at(0).prop('onClick');
if (handler) {

View File

@@ -103,7 +103,7 @@ describe('SavedQueries', () => {
expect(wrapper.find('ListViewCard')).toExist();
});
it('it renders a submenu with clickable tables and buttons', async () => {
it('renders a submenu with clickable tables and buttons', async () => {
expect(wrapper.find(SubMenu)).toExist();
expect(wrapper.find('li')).toHaveLength(1);
expect(wrapper.find('button')).toHaveLength(2);