Files
superset2/superset/assets/spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx
Maxime Beauchemin da813b7ee3 [table editor] allow selecting physical table (#6046)
* [table editor] allow selecting physical table

* Using classes for padding
2019-01-15 08:53:24 -08:00

46 lines
1.2 KiB
JavaScript

import React from 'react';
import configureStore from 'redux-mock-store';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import thunk from 'redux-thunk';
import { table, defaultQueryEditor, initialState } from './fixtures';
import SqlEditorLeftBar from '../../../src/SqlLab/components/SqlEditorLeftBar';
import TableElement from '../../../src/SqlLab/components/TableElement';
describe('SqlEditorLeftBar', () => {
const mockedProps = {
actions: {
queryEditorSetSchema: sinon.stub(),
queryEditorSetDb: sinon.stub(),
setDatabases: sinon.stub(),
addTable: sinon.stub(),
addDangerToast: sinon.stub(),
},
tables: [table],
queryEditor: defaultQueryEditor,
database: {},
height: 0,
};
const middlewares = [thunk];
const mockStore = configureStore(middlewares);
const store = mockStore(initialState);
let wrapper;
beforeEach(() => {
wrapper = shallow(<SqlEditorLeftBar {...mockedProps} />, {
context: { store },
});
});
it('is valid', () => {
expect(React.isValidElement(<SqlEditorLeftBar {...mockedProps} />)).toBe(true);
});
it('renders a TableElement', () => {
expect(wrapper.find(TableElement)).toHaveLength(1);
});
});