2016-10-19 12:17:08 -04:00
|
|
|
import React from 'react';
|
|
|
|
import Link from '../../../javascripts/SqlLab/components/Link';
|
2016-10-25 19:44:32 -04:00
|
|
|
import TableElement from '../../../javascripts/SqlLab/components/TableElement';
|
|
|
|
import { table } from './fixtures';
|
|
|
|
import { mount, shallow } from 'enzyme';
|
2016-10-19 12:17:08 -04:00
|
|
|
import { describe, it } from 'mocha';
|
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
|
|
|
|
|
|
describe('TableElement', () => {
|
|
|
|
const mockedProps = {
|
2016-10-25 19:44:32 -04:00
|
|
|
table,
|
|
|
|
};
|
|
|
|
it('renders', () => {
|
2016-10-19 12:17:08 -04:00
|
|
|
expect(
|
|
|
|
React.isValidElement(<TableElement />)
|
|
|
|
).to.equal(true);
|
|
|
|
});
|
2016-10-25 19:44:32 -04:00
|
|
|
it('renders with props', () => {
|
2016-10-19 12:17:08 -04:00
|
|
|
expect(
|
|
|
|
React.isValidElement(<TableElement {...mockedProps} />)
|
|
|
|
).to.equal(true);
|
|
|
|
});
|
|
|
|
it('has 3 Link elements', () => {
|
|
|
|
const wrapper = shallow(<TableElement {...mockedProps} />);
|
2016-10-21 02:40:24 -04:00
|
|
|
expect(wrapper.find(Link)).to.have.length(2);
|
2016-10-19 12:17:08 -04:00
|
|
|
});
|
|
|
|
it('has 14 columns', () => {
|
|
|
|
const wrapper = shallow(<TableElement {...mockedProps} />);
|
|
|
|
expect(wrapper.find('div.table-column')).to.have.length(14);
|
|
|
|
});
|
2016-10-25 19:44:32 -04:00
|
|
|
it('mounts', () => {
|
|
|
|
mount(<TableElement {...mockedProps} />);
|
|
|
|
});
|
2016-10-19 12:17:08 -04:00
|
|
|
});
|