Files
superset2/superset/assets/spec/javascripts/explore/components/DatasourceControl_spec.jsx
Chris Williams 96228adda9 [superset-client][datasource editor] replace ajax with SupersetClient (#6134)
* [superset-client][datasource editor] replace ajax with SupersetClient

* [superset-client][datasource control] replace ajax with SupersetClient

* [superset-client][datasource editor] remove unused funcs in DatasourceControl

* [superset-client][data source control] lint, remove toasts

* [superset-client] fix DatasourceControl_spec

* [superset-client] remove unneeded functional setState calls
2018-10-19 11:41:11 -07:00

39 lines
975 B
JavaScript

import React from 'react';
import sinon from 'sinon';
import configureStore from 'redux-mock-store';
import { shallow } from 'enzyme';
import DatasourceModal from '../../../../src/datasource/DatasourceModal';
import DatasourceControl from '../../../../src/explore/components/controls/DatasourceControl';
const defaultProps = {
name: 'datasource',
label: 'Datasource',
value: '1__table',
datasource: {
name: 'birth_names',
type: 'table',
uid: '1__table',
id: 1,
columns: [],
metrics: [],
database: {
backend: 'mysql',
name: 'main',
},
},
onChange: sinon.spy(),
};
describe('DatasourceControl', () => {
function setup() {
const mockStore = configureStore([]);
const store = mockStore({});
return shallow(<DatasourceControl {...defaultProps} />, { context: { store } });
}
it('renders a Modal', () => {
const wrapper = setup();
expect(wrapper.find(DatasourceModal)).toHaveLength(1);
});
});