From 8d8ca3fc13fac4bc1631fe9f6ab9dcc119a1c672 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 4 Feb 2022 12:37:13 -0800 Subject: [PATCH] [Tests] `default-props-match-prop-types`: add passing test Closes #1593 --- .../rules/default-props-match-prop-types.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/lib/rules/default-props-match-prop-types.js b/tests/lib/rules/default-props-match-prop-types.js index 141c254e7c..f61b5197b1 100644 --- a/tests/lib/rules/default-props-match-prop-types.js +++ b/tests/lib/rules/default-props-match-prop-types.js @@ -1756,5 +1756,32 @@ ruleTester.run('default-props-match-prop-types', rule, { }, ], }, + { + code: ` + export type SharedProps = {| + disabled: boolean, + |}; + + type Props = {| + ...SharedProps, + focused?: boolean, + |}; + + class Foo extends React.Component { + static defaultProps = { + disabled: false + }; + }; + `, + features: ['flow'], + errors: [ + { + messageId: 'requiredHasDefault', + data: { + name: 'disabled', + }, + }, + ], + }, ]), });