From 2b3d0df0b9030f996dfde8233d0646d6f98bd19b Mon Sep 17 00:00:00 2001 From: Jeff Niu Date: Mon, 16 Oct 2017 13:24:36 -0700 Subject: [PATCH] unit tests for OptionDescription component --- .../components/OptionDescription_spec.jsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 superset/assets/spec/javascripts/components/OptionDescription_spec.jsx diff --git a/superset/assets/spec/javascripts/components/OptionDescription_spec.jsx b/superset/assets/spec/javascripts/components/OptionDescription_spec.jsx new file mode 100644 index 0000000000000..e9a6a9dfab8fd --- /dev/null +++ b/superset/assets/spec/javascripts/components/OptionDescription_spec.jsx @@ -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(); + }); + + 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'); + }); +});