test: add tests for translated-external-link

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-05-22 18:12:14 +02:00 committed by Tilman Vatteroth
parent 857f808893
commit 055bb6fcfd
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TranslatedExternalLink renders with i18nKey 1`] = `
<div>
<a
class="text-light"
dir="auto"
href="https://example.com"
rel="noopener noreferrer"
target="_blank"
>
testi18nKey
</a>
</div>
`;

View file

@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { TranslatedExternalLink } from './translated-external-link'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { render } from '@testing-library/react'
describe('TranslatedExternalLink', () => {
const href = 'https://example.com'
beforeAll(async () => {
await mockI18n()
})
it('renders with i18nKey', () => {
const view = render(<TranslatedExternalLink i18nKey={'testi18nKey'} href={href} />)
expect(view.container).toMatchSnapshot()
})
})