Files
superset2/superset/assets/spec/javascripts/explore/components/DatasourceControl_spec.jsx
Chris Williams 19ac6e1231 get rid of global notify (#5355)
* [toasts] get rid of notify globals, refactor messageToasts for use by entire app

* [remove notify] use arrow func in ajax call

* fix lint + tests

* actually fix tests from messageToast refactor

* add 'test:one' npm script

* debugger

* [toasts] convert bootstrap flash messages to toasts in explore + sqllab

* [toasts][tests] import from right file
2018-07-12 11:50:25 -07:00

41 lines
1012 B
JavaScript

import React from 'react';
import sinon from 'sinon';
import configureStore from 'redux-mock-store';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { shallow } from 'enzyme';
import { Modal } from 'react-bootstrap';
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 } }).dive();
}
it('renders a Modal', () => {
const wrapper = setup();
expect(wrapper.find(Modal)).to.have.lengthOf(1);
});
});