Skip to content

Commit

Permalink
Return undefined if testId if not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
rasitozcan committed Dec 7, 2023
1 parent db5753c commit 43e585e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ const ValidationErrors = ({
return (
<Fragment key={rule}>
{reasons?.map((reason, index) => (
// eslint-disable-next-line react/no-array-index-key
<List.Item data-testid={`${testId}-${index}`} key={index}>
<List.Item
// eslint-disable-next-line react/no-array-index-key
key={index}
data-testid={testId && `${testId}-${index}`}
>
{reason.message ?? reason}
</List.Item>
))}
Expand Down

0 comments on commit 43e585e

Please sign in to comment.