Files
superset2/superset/assets/spec/javascripts/sqllab/SqlEditor_spec.jsx
Denny Biasiolli dee36491c5 Fix js warnings (#2693)
* react: using prop-types package to fix deprecated React.PropTypes property warning

https://facebook.github.io/react/warnings/dont-call-proptypes.html

* removing babel devDependency because has been deprecated in favor of babel-cli

this fixes a warning during `npm install`:
```
npm WARN deprecated babel@6.23.0:
In 6.x, the babel package has been deprecated in favor of babel-cli.
Check https://opencollective.com/babel to support the Babel maintainers
```

* js: setting ExploreActionButtons.queryEndpoint PropType as required

because it's required in the child component DisplayQueryButton

* js(tests): using object in expandedSlices prop type of SliceCell tests

* js(tests): adding required props to SqlEditor mockedProps

* js(tests): adding required prop editorHeight to TabbedSqlEditors mockedProps

* js: removing unused moments dependency
2017-04-28 17:56:29 -07:00

32 lines
924 B
JavaScript

import React from 'react';
import { shallow } from 'enzyme';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import { initialState, queries, table } from './fixtures';
import SqlEditor from '../../../javascripts/SqlLab/components/SqlEditor';
import SqlEditorLeftBar from '../../../javascripts/SqlLab/components/SqlEditorLeftBar';
describe('SqlEditor', () => {
const mockedProps = {
actions: {},
database: {},
queryEditor: initialState.queryEditors[0],
latestQuery: queries[0],
tables: [table],
queries,
height: '',
editorQueries: [],
dataPreviewQueries: [],
};
it('is valid', () => {
expect(
React.isValidElement(<SqlEditor {...mockedProps} />),
).to.equal(true);
});
it('render a SqlEditorLeftBar', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SqlEditorLeftBar)).to.have.length(1);
});
});