diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-09-20 05:30:52 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-09-20 05:31:10 +0800 |
commit | 2cfdc95eebc3e0a878017090f22e5136cff709a6 (patch) | |
tree | 34ba4eee9afad4c92d748f76f76b50a0ae96a113 /ui/app/higher-order-components | |
parent | 77e8eac4b380b35f4ab2e6abd82fe929ec7f7c1b (diff) | |
download | tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar.gz tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar.bz2 tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar.lz tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar.xz tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.tar.zst tangerine-wallet-browser-2cfdc95eebc3e0a878017090f22e5136cff709a6.zip |
Add unit tests
Diffstat (limited to 'ui/app/higher-order-components')
-rw-r--r-- | ui/app/higher-order-components/with-modal-props/tests/with-modal-props.test.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ui/app/higher-order-components/with-modal-props/tests/with-modal-props.test.js b/ui/app/higher-order-components/with-modal-props/tests/with-modal-props.test.js new file mode 100644 index 000000000..654e7062a --- /dev/null +++ b/ui/app/higher-order-components/with-modal-props/tests/with-modal-props.test.js @@ -0,0 +1,43 @@ + +import assert from 'assert' +import configureMockStore from 'redux-mock-store' +import { mount } from 'enzyme' +import React from 'react' +import withModalProps from '../with-modal-props' + +const mockState = { + appState: { + modal: { + modalState: { + props: { + prop1: 'prop1', + prop2: 2, + prop3: true, + }, + }, + }, + }, +} + +describe('withModalProps', () => { + it('should return a component wrapped with modal state props', () => { + const TestComponent = props => ( + <div className="test">Testing</div> + ) + const WrappedComponent = withModalProps(TestComponent) + const store = configureMockStore()(mockState) + const wrapper = mount( + <WrappedComponent store={store} /> + ) + + assert.ok(wrapper) + const testComponent = wrapper.find(TestComponent).at(0) + assert.equal(testComponent.length, 1) + assert.equal(testComponent.find('.test').text(), 'Testing') + const testComponentProps = testComponent.props() + assert.equal(testComponentProps.prop1, 'prop1') + assert.equal(testComponentProps.prop2, 2) + assert.equal(testComponentProps.prop3, true) + assert.equal(typeof testComponentProps.hideModal, 'function') + }) +}) |