From 2a89c90e0bfd74ad2bf88f7da080c58a02a9b33b Mon Sep 17 00:00:00 2001 From: Jeff Niu Date: Mon, 16 Oct 2017 16:31:43 -0700 Subject: [PATCH] unit tests for OptionDescription component (#3678) --- .../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 0000000000..e9a6a9dfab --- /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'); + }); +});