Skip to content

Commit

Permalink
unit tests for OptionDescription component (#3678)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogball authored and mistercrunch committed Oct 16, 2017
1 parent ce5fa37 commit 2a89c90
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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');
});
});

0 comments on commit 2a89c90

Please sign in to comment.