diff options
author | Anike Arni <aarni@thoughtworks.com> | 2017-02-08 10:55:10 -0200 |
---|---|---|
committer | Anike Arni <aarni@thoughtworks.com> | 2017-02-08 13:51:37 -0200 |
commit | 16190197f72ea242ae239dc2741e2887c7008dfa (patch) | |
tree | 829ca7f57d7f90af67d6ffe47346b0260609163a /web-ui/test/unit | |
parent | 7f76c79319bf0817222fc88011fd870d97648963 (diff) |
[#922] Add test coverage for new js files
Since this added a lot of scripts to our npm scripts, this commit also
organizes the package.json. with @tayanefernandes
Diffstat (limited to 'web-ui/test/unit')
-rw-r--r-- | web-ui/test/unit/common/input_field/input_field.spec.js | 20 | ||||
-rw-r--r-- | web-ui/test/unit/common/submit_button/submit_button.spec.js | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/web-ui/test/unit/common/input_field/input_field.spec.js b/web-ui/test/unit/common/input_field/input_field.spec.js new file mode 100644 index 00000000..88983f4f --- /dev/null +++ b/web-ui/test/unit/common/input_field/input_field.spec.js @@ -0,0 +1,20 @@ +import { shallow } from 'enzyme' +import expect from 'expect' +import React from 'react' +import InputField from 'src/common/input_field/input_field' + +describe('InputField', () => { + let inputField + + beforeEach(() => { + inputField = shallow(<InputField label="Email" name="email" />) + }) + + it('renders an input of type text for email', () => { + expect(inputField.find('input[type="text"]').props().name).toEqual('email') + }) + + it('renders a label for the email', () => { + expect(inputField.find('label').text()).toEqual('Email') + }) +}) diff --git a/web-ui/test/unit/common/submit_button/submit_button.spec.js b/web-ui/test/unit/common/submit_button/submit_button.spec.js new file mode 100644 index 00000000..629b3545 --- /dev/null +++ b/web-ui/test/unit/common/submit_button/submit_button.spec.js @@ -0,0 +1,16 @@ +import { shallow } from 'enzyme' +import expect from 'expect' +import React from 'react' +import SubmitButton from 'src/common/submit_button/submit_button' + +describe('SubmitButton', () => { + let submitButton + + beforeEach(() => { + submitButton = shallow(<SubmitButton buttonText="Add Email" />) + }) + + it('renders an input of type submit for add email', () => { + expect(submitButton.find('input[type="submit"]').props().value).toEqual('Add Email') + }) +}) |