From ef9ee67c19662b033581a70a0658348f50694813 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Thu, 1 Jun 2017 20:37:38 +0800 Subject: [PATCH] [web] Add tests for js/components/ContentView/ContentViewOptions.jsx --- .../ContentView/ContentViewOptionsSpec.js | 19 +++++++++ .../ContentViewOptionsSpec.js.snap | 41 +++++++++++++++++++ .../ContentView/ContentViewOptions.jsx | 6 ++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js create mode 100644 web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap diff --git a/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js b/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js new file mode 100644 index 000000000..0b1e8538c --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js @@ -0,0 +1,19 @@ +import React from 'react' +import renderer from 'react-test-renderer' +import ContentViewOptions from '../../../components/ContentView/ContentViewOptions' +import { Provider } from 'react-redux' +import { TFlow, TStore } from '../../ducks/tutils' + +let tflow = new TFlow() + +describe('ContentViewOptions Component', () => { + let store = TStore() + it('should render correctly', () => { + let provider = renderer.create( + + + ), + tree = provider.toJSON() + expect(tree).toMatchSnapshot() + }) +}) diff --git a/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap b/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap new file mode 100644 index 000000000..e3561ec1a --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap @@ -0,0 +1,41 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ContentViewOptions Component should render correctly 1`] = ` +
+ + + View: + + edit + +   + + + +   + + + + +   +
+`; diff --git a/web/src/js/components/ContentView/ContentViewOptions.jsx b/web/src/js/components/ContentView/ContentViewOptions.jsx index e3cc39cd4..109fb861d 100644 --- a/web/src/js/components/ContentView/ContentViewOptions.jsx +++ b/web/src/js/components/ContentView/ContentViewOptions.jsx @@ -4,6 +4,7 @@ import { connect } from 'react-redux' import ViewSelector from './ViewSelector' import UploadContentButton from './UploadContentButton' import DownloadContentButton from './DownloadContentButton' +import { uploadContent } from '../../ducks/flows' ContentViewOptions.propTypes = { flow: PropTypes.object.isRequired, @@ -28,5 +29,8 @@ export default connect( state => ({ contentViewDescription: state.ui.flow.viewDescription, readonly: !state.ui.flow.modifiedFlow, - }) + }), + { + uploadContent: uploadContent + } )(ContentViewOptions)