test: add tests for translated-internal-link

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

View file

@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TranslatedInternalLink renders with i18nKey 1`] = `
<div>
<a
class="text-light"
href="/test"
>
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 { TranslatedInternalLink } from './translated-internal-link'
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { render } from '@testing-library/react'
describe('TranslatedInternalLink', () => {
const href = '/test'
beforeAll(async () => {
await mockI18n()
})
it('renders with i18nKey', () => {
const view = render(<TranslatedInternalLink i18nKey={'testi18nKey'} href={href} />)
expect(view.container).toMatchSnapshot()
})
})