diff --git a/src/app/pages/StakingPage/Features/ValidatorMediaInfo/__tests__/index.test.tsx b/src/app/pages/StakingPage/Features/ValidatorMediaInfo/__tests__/index.test.tsx index 34a43d82e7..364c57edf7 100644 --- a/src/app/pages/StakingPage/Features/ValidatorMediaInfo/__tests__/index.test.tsx +++ b/src/app/pages/StakingPage/Features/ValidatorMediaInfo/__tests__/index.test.tsx @@ -21,4 +21,16 @@ describe('', () => { const el = screen.queryByRole('link') expect(el).toBeNull() }) + + it('should display an email if the address is valid', () => { + render() + const el = screen.getByRole('link') + expect(el).toHaveAttribute('href', 'mailto:test@test.com') + }) + + it('should not display the email if the address is dangerous', () => { + render() + const el = screen.queryByRole('link') + expect(el).toBeNull() + }) }) diff --git a/src/app/pages/StakingPage/Features/ValidatorMediaInfo/index.tsx b/src/app/pages/StakingPage/Features/ValidatorMediaInfo/index.tsx index c57ba87474..92cee92c24 100644 --- a/src/app/pages/StakingPage/Features/ValidatorMediaInfo/index.tsx +++ b/src/app/pages/StakingPage/Features/ValidatorMediaInfo/index.tsx @@ -17,7 +17,9 @@ export const ValidatorMediaInfo = memo((props: Props) => { const info = props.mediaInfo return ( <> - {info.email_address && } />} + {info.email_address && !info.email_address.includes('?') && ( + } /> + )} {info.website_link && isWebUri(info.website_link) && ( } /> )}