Skip to content

Commit

Permalink
[Test]: add more test cases for PropTypes.exact support
Browse files Browse the repository at this point in the history
  • Loading branch information
jzabala committed Aug 13, 2020
1 parent 32abef3 commit ac3d11a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/lib/rules/prop-types.js
Expand Up @@ -5848,6 +5848,49 @@ ruleTester.run('prop-types', rule, {
errors: [{
message: "'foo.c' is missing in props validation"
}]
},
{
code: `
function Zoo(props) {
return (
<>
{props.foo.c}
</>
);
}
Zoo.propTypes = {
foo: React.PropTypes.exact({
a: PropTypes.number,
b: PropTypes.number,
}),
};
`,
errors: [{
message: "'foo.c' is missing in props validation"
}]
},
{
code: `
function Zoo(props) {
return (
<>
{props.foo.c}
</>
);
}
Zoo.propTypes = {
foo: Foo.PropTypes.exact({
a: PropTypes.number,
b: PropTypes.number,
}),
};
`,
settings,
errors: [{
message: "'foo.c' is missing in props validation"
}]
}
])
)
Expand Down

0 comments on commit ac3d11a

Please sign in to comment.