mirror of
https://github.com/apache/superset.git
synced 2026-04-09 11:25:23 +00:00
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues * [lint] fix undefined var in TimeTable.jsx
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { FormControl } from 'react-bootstrap';
|
|
import { shallow } from 'enzyme';
|
|
import { expect } from 'chai';
|
|
import SaveQuery from '../../../src/SqlLab/components/SaveQuery';
|
|
import ModalTrigger from '../../../src/components/ModalTrigger';
|
|
|
|
describe('SavedQuery', () => {
|
|
const mockedProps = {
|
|
dbId: 1,
|
|
schema: 'main',
|
|
sql: 'SELECT * FROM t',
|
|
defaultLabel: 'untitled',
|
|
animation: false,
|
|
};
|
|
it('is valid', () => {
|
|
expect(
|
|
React.isValidElement(<SaveQuery />),
|
|
).to.equal(true);
|
|
});
|
|
it('is valid with props', () => {
|
|
expect(
|
|
React.isValidElement(<SaveQuery {...mockedProps} />),
|
|
).to.equal(true);
|
|
});
|
|
it('has a ModalTrigger', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
expect(wrapper.find(ModalTrigger)).to.have.length(1);
|
|
});
|
|
it('has a cancel button', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
const modal = shallow(wrapper.instance().renderModalBody());
|
|
expect(modal.find('.cancelQuery')).to.have.length(1);
|
|
});
|
|
it('has 2 FormControls', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
const modal = shallow(wrapper.instance().renderModalBody());
|
|
expect(modal.find(FormControl)).to.have.length(2);
|
|
});
|
|
});
|