From 055bb6fcfd207c7835d5ad01d8edc7c4b48ab248 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 22 May 2022 18:12:14 +0200 Subject: [PATCH] test: add tests for translated-external-link Signed-off-by: Philip Molares --- .../translated-external-link.test.tsx.snap | 15 ++++++++++++++ .../links/translated-external-link.test.tsx | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/components/common/links/__snapshots__/translated-external-link.test.tsx.snap create mode 100644 src/components/common/links/translated-external-link.test.tsx diff --git a/src/components/common/links/__snapshots__/translated-external-link.test.tsx.snap b/src/components/common/links/__snapshots__/translated-external-link.test.tsx.snap new file mode 100644 index 000000000..baaebbd31 --- /dev/null +++ b/src/components/common/links/__snapshots__/translated-external-link.test.tsx.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`TranslatedExternalLink renders with i18nKey 1`] = ` +
+ + testi18nKey + +
+`; diff --git a/src/components/common/links/translated-external-link.test.tsx b/src/components/common/links/translated-external-link.test.tsx new file mode 100644 index 000000000..e4dd54155 --- /dev/null +++ b/src/components/common/links/translated-external-link.test.tsx @@ -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() + expect(view.container).toMatchSnapshot() + }) +})