Skip to content

Commit

Permalink
Adds tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karolina-benitez committed Aug 26, 2020
1 parent bb88433 commit 1e34758
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/lib/rules/prefer-read-only-props.js
Expand Up @@ -131,6 +131,37 @@ ruleTester.run('prefer-read-only-props', rule, {
name: PropTypes.string,
};
`
},
{
// Class component with typed props argument
code: `
type Props = $ReadOnly<{
name: string,
}>
class Hello extends React.Component<Props> {
render () {
return <div>Hello {this.props.name}</div>;
}
}
`,
parser: parsers.BABEL_ESLINT
},
{
// Class component with typed props argument
code: `
type Props = $ReadOnly<{
+firstName: string,
lastName: string
}>
class Hello extends React.Component<Props> {
render () {
return <div>Hello {this.props.firstName} {this.props.lastName}</div>;
}
}
`,
parser: parsers.BABEL_ESLINT
}
],

Expand Down

0 comments on commit 1e34758

Please sign in to comment.