Skip to content

Commit 5724d6a

Browse files
committed
add a test case for where the outer prop name is in props validation, but the inner one is not
1 parent 7f93bf6 commit 5724d6a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,24 @@ ruleTester.run('prop-types', rule, {
24252425
{message: "'foo' is missing in props validation"},
24262426
{message: "'foo.bar' is missing in props validation"}
24272427
]
2428+
}, {
2429+
code: `
2430+
class Hello extends React.Component {
2431+
render() {
2432+
const { foo: { bar } } = this.props;
2433+
return <p>{bar}</p>
2434+
}
2435+
}
2436+
2437+
Hello.propTypes = {
2438+
foo: PropTypes.shape({
2439+
_: PropTypes.string,
2440+
})
2441+
}
2442+
`,
2443+
errors: [
2444+
{message: "'foo.bar' is missing in props validation"}
2445+
]
24282446
}, {
24292447
code: `
24302448
function Foo({ foo: { bar } }) {

0 commit comments

Comments
 (0)