Skip to content

Commit

Permalink
add a test case for where the outer prop name is in props validation,…
Browse files Browse the repository at this point in the history
… but the inner one is not
  • Loading branch information
golopot committed Jun 6, 2019
1 parent 7f93bf6 commit 5724d6a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/lib/rules/prop-types.js
Expand Up @@ -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 <p>{bar}</p>
}
}
Hello.propTypes = {
foo: PropTypes.shape({
_: PropTypes.string,
})
}
`,
errors: [
{message: "'foo.bar' is missing in props validation"}
]
}, {
code: `
function Foo({ foo: { bar } }) {
Expand Down

0 comments on commit 5724d6a

Please sign in to comment.