From 5724d6a8b16acade46b79c3e19dc63810511744c Mon Sep 17 00:00:00 2001 From: golopot Date: Thu, 6 Jun 2019 13:24:24 +0800 Subject: [PATCH] add a test case for where the outer prop name is in props validation, but the inner one is not --- tests/lib/rules/prop-types.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index a5871cf6a6..bbd1c07ba5 100755 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -2425,6 +2425,24 @@ ruleTester.run('prop-types', rule, { {message: "'foo' is missing in props validation"}, {message: "'foo.bar' is missing in props validation"} ] + }, { + code: ` + class Hello extends React.Component { + render() { + const { foo: { bar } } = this.props; + return

{bar}

+ } + } + + Hello.propTypes = { + foo: PropTypes.shape({ + _: PropTypes.string, + }) + } + `, + errors: [ + {message: "'foo.bar' is missing in props validation"} + ] }, { code: ` function Foo({ foo: { bar } }) {