Skip to content

Commit

Permalink
Merge 250f78e into 494a880
Browse files Browse the repository at this point in the history
  • Loading branch information
judeinno committed Mar 18, 2019
2 parents 494a880 + 250f78e commit eec5760
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/dictionaryConcepts/components/MapType.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import { INTERNAL_MAPPING_DEFAULT_SOURCE, MAP_TYPES_DEFAULTS } from './helperFunction';

const mapType = (props) => {
const {
index, map_type, map_types, updateEventListener, url,
index, map_type, map_types, updateEventListener, url, source,
} = props;
return (
<select
tabIndex={index}
defaultValue={map_type}
value={source !== INTERNAL_MAPPING_DEFAULT_SOURCE ? MAP_TYPES_DEFAULTS[1] : map_type}
className="form-control"
placeholder="map type"
type="text"
Expand All @@ -33,12 +34,14 @@ mapType.propTypes = {
updateEventListener: PropTypes.func,
map_types: PropTypes.array,
url: PropTypes.string,
source: PropTypes.string,
};

mapType.defaultProps = {
url: '',
map_type: '',
index: 0,
source: INTERNAL_MAPPING_DEFAULT_SOURCE,
updateEventListener: () => {},
map_types: ['SAME-AS', 'NARROWER-THAN', 'BROADER-THAN', 'Associated finding', 'Associated morphology',
'Associated procedure', 'Associated with', 'Causative agent', 'Finding site', 'Has specimen', 'Laterality', 'Severity', 'Access', 'After',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const DATA_TYPES = [
'Text',
];

export const MAP_TYPES_DEFAULTS = ['SAME-AS', 'NARROWER-THAN'];

export const INTERNAL_MAPPING_DEFAULT_SOURCE = 'CIEL';
export const CIEL_SOURCE_URL = '/orgs/CIEL/sources/CIEL/';

Expand Down
56 changes: 56 additions & 0 deletions src/tests/Signup/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,60 @@ describe('Sign up Component', () => {
wrapper.find('#firstName').simulate('change', event);
expect(spy).toHaveBeenCalledTimes(1);
});

it('should handle text lastname input', () => {
const event = {
preventDefault: jest.fn(),
target: {
value: 'user',
name: 'lastname',
},
};
const spy = jest.spyOn(wrapper.find('Signup').instance(), 'handleInput');
wrapper.instance().forceUpdate();
wrapper.find('#lastname').simulate('change', event);
expect(spy).toHaveBeenCalledTimes(1);
});

it('should handle text email input', () => {
const event = {
preventDefault: jest.fn(),
target: {
value: 'user@gmail.com',
name: 'email',
},
};
const spy = jest.spyOn(wrapper.find('Signup').instance(), 'handleInput');
wrapper.instance().forceUpdate();
wrapper.find('#email').simulate('change', event);
expect(spy).toHaveBeenCalledTimes(1);
});

it('should handle text userName input', () => {
const event = {
preventDefault: jest.fn(),
target: {
value: 'user',
name: 'username',
},
};
const spy = jest.spyOn(wrapper.find('Signup').instance(), 'handleInput');
wrapper.instance().forceUpdate();
wrapper.find('#userName').simulate('change', event);
expect(spy).toHaveBeenCalledTimes(1);
});

it('should handle text password input', () => {
const event = {
preventDefault: jest.fn(),
target: {
value: 'user',
name: 'password',
},
};
const spy = jest.spyOn(wrapper.find('Signup').instance(), 'handleInput');
wrapper.instance().forceUpdate();
wrapper.find('#password').simulate('change', event);
expect(spy).toHaveBeenCalledTimes(1);
});
});

0 comments on commit eec5760

Please sign in to comment.