unit tests for OptionDescription component (#3678)

This commit is contained in:
Jeff Niu 2017-10-16 16:31:43 -07:00 committed by Maxime Beauchemin
parent ce5fa379ec
commit 2a89c90e0b
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import React from 'react';
import { shallow } from 'enzyme';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import InfoTooltipWithTrigger from '../../../javascripts/components/InfoTooltipWithTrigger';
import OptionDescription from '../../../javascripts/components/OptionDescription';
const defaultProps = {
option: {
label: 'Some option',
description: 'Description for some option',
},
};
describe('OptionDescription', () => {
let wrapper;
let props;
beforeEach(() => {
props = { option: Object.assign({}, defaultProps.option) };
wrapper = shallow(<OptionDescription {...props} />);
});
it('renders an InfoTooltipWithTrigger', () => {
expect(wrapper.find(InfoTooltipWithTrigger)).to.have.lengthOf(1);
});
it('renders a span with the label', () => {
expect(wrapper.find('.option-label').text()).to.equal('Some option');
});
});