apply redux for VisualizeModal (#2795)

* redux visualize modal

* redux visualize modal

- apply redux
- add unit test for connect container component
- fix lint error

* redux visualize modal

- apply redux
- add unit test for connect container component
- fix lint error
This commit is contained in:
Grace Guo
2017-05-24 11:58:54 -07:00
committed by GitHub
parent 69685b9dcc
commit d0a04cde49
6 changed files with 183 additions and 25 deletions

View File

@@ -1,12 +1,12 @@
import React from 'react';
import { mount } from 'enzyme';
import { shallow } from 'enzyme';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import { Table } from 'reactable';
import { queries } from './fixtures';
import QueryTable from '../../../javascripts/SqlLab/components/QueryTable';
describe('QueryTable', () => {
const mockedProps = {
queries,
@@ -20,8 +20,9 @@ describe('QueryTable', () => {
).to.equal(true);
});
it('renders a proper table', () => {
const wrapper = mount(<QueryTable {...mockedProps} />);
expect(wrapper.find('table')).to.have.length(1);
expect(wrapper.find('tr')).to.have.length(4);
const wrapper = shallow(<QueryTable {...mockedProps} />);
expect(wrapper.find(Table)).to.have.length(1);
expect(wrapper.find(Table).shallow().find('table')).to.have.length(1);
expect(wrapper.find(Table).shallow().find('table').find('Tr')).to.have.length(2);
});
});