Added more test cases for prop types from an external file

This commit is contained in:
patrick.lafrance 2019-11-20 09:19:06 -05:00
parent 16a51504bc
commit 6fc021be09
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import PropTypes from 'prop-types';
export const PRESET_SHAPE = {
text: PropTypes.string.isRequired,
startDate: PropTypes.object.isRequired,
endDate: PropTypes.object.isRequired,
};
export const SOME_PROP_TYPES = {
ext1: PropTypes.string,
ext2: PropTypes.number,
};

View File

@ -1,6 +1,8 @@
/* eslint-disable react/require-default-props */
/* eslint-disable react/no-unused-prop-types */
import React from 'react';
import PropTypes, { string, shape } from 'prop-types';
import { PRESET_SHAPE, SOME_PROP_TYPES } from './ext';
const NAMED_OBJECT = {
text: PropTypes.string.isRequired,
@ -159,6 +161,7 @@ PropTypesProps.propTypes = {
),
})
),
arrayExternalShape: PropTypes.arrayOf(PropTypes.shape(PRESET_SHAPE)),
/**
* A simple `objectOf` propType.
*/
@ -257,6 +260,7 @@ PropTypesProps.propTypes = {
requiredString: PropTypes.string.isRequired,
nullDefaultValue: PropTypes.string,
undefinedDefaultValue: PropTypes.string,
...SOME_PROP_TYPES,
};
PropTypesProps.defaultProps = {