Eslint error cleanup (#10657)

* moving two console errors to logger errors

* nixing unused map index

* nixing unused param

* linting

* changing an alert to a toast

* fixing tests

* lint fix

* one letter change, just to see if iti gets CI to pass this test.
This commit is contained in:
Evan Rusackas
2020-08-24 14:04:27 -07:00
committed by GitHub
parent 9461f9c1e0
commit fdfb7cdfd2
7 changed files with 45 additions and 18 deletions

View File

@@ -20,12 +20,17 @@ import React from 'react';
import { shallow, mount } from 'enzyme';
import { OverlayTrigger } from 'react-bootstrap';
import sinon from 'sinon';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import EmbedCodeButton from 'src/explore/components/EmbedCodeButton';
import * as exploreUtils from 'src/explore/exploreUtils';
import * as common from 'src/utils/common';
describe('EmbedCodeButton', () => {
const mockStore = configureStore([]);
const store = mockStore({});
const defaultProps = {
latestQueryFormData: { datasource: '107__table' },
};
@@ -41,11 +46,16 @@ describe('EmbedCodeButton', () => {
expect(wrapper.find(OverlayTrigger)).toExist();
});
it('should create shorten, standalone, explore url', () => {
it('should create a short, standalone, explore url', () => {
const spy1 = sinon.spy(exploreUtils, 'getExploreLongUrl');
const spy2 = sinon.spy(common, 'getShortUrl');
const wrapper = mount(<EmbedCodeButton {...defaultProps} />);
const wrapper = mount(<EmbedCodeButton {...defaultProps} />, {
wrappingComponent: Provider,
wrappingComponentProps: {
store,
},
});
wrapper.setState({
height: '1000',
width: '2000',

View File

@@ -18,13 +18,18 @@
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import Link from 'src/components/Link';
import TableElement from 'src/SqlLab/components/TableElement';
import ColumnElement from 'src/SqlLab/components/ColumnElement';
import { mockedActions, table } from './fixtures';
describe('TableElement', () => {
const mockStore = configureStore([]);
const store = mockStore({});
const mockedProps = {
actions: mockedActions,
table,
@@ -45,7 +50,11 @@ describe('TableElement', () => {
expect(wrapper.find(ColumnElement)).toHaveLength(14);
});
it('mounts', () => {
mount(<TableElement {...mockedProps} />);
mount(
<Provider store={store}>
<TableElement {...mockedProps} />
</Provider>,
);
});
it('sorts columns', () => {
const wrapper = shallow(<TableElement {...mockedProps} />);
@@ -58,7 +67,11 @@ describe('TableElement', () => {
);
});
it('calls the collapseTable action', () => {
const wrapper = mount(<TableElement {...mockedProps} />);
const wrapper = mount(
<Provider store={store}>
<TableElement {...mockedProps} />
</Provider>,
);
expect(mockedActions.collapseTable.called).toBe(false);
wrapper.find('.table-name').simulate('click');
expect(mockedActions.collapseTable.called).toBe(true);