refactor: move mockI18n

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-11 13:56:05 +02:00
parent 3962cafa5d
commit 86276b0753
35 changed files with 36 additions and 36 deletions

View file

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../test-utils/mock-i18n'
import { mockI18n } from '../../../../test-utils/mock-i18n'
import { TestMarkdownRenderer } from '../../test-utils/test-markdown-renderer'
import { EmojiMarkdownExtension } from './emoji-markdown-extension'
import { render } from '@testing-library/react'

View file

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { mockI18n } from '../../test-utils/mock-i18n'
import { mockI18n } from '../../../../test-utils/mock-i18n'
import { TestMarkdownRenderer } from '../../test-utils/test-markdown-renderer'
import { LinkifyFixMarkdownExtension } from './linkify-fix-markdown-extension'
import { render } from '@testing-library/react'

View file

@ -1,26 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { TFunction } from 'i18next'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
/**
* Initializes i18n with minimal settings and without any data, so it just returns the used key as translation.
*
* @return A promise that resolves if i18n has been initialized
*/
export const mockI18n = (): Promise<TFunction> => {
return i18n.use(initReactI18next).init({
lng: 'en',
fallbackLng: 'en',
ns: ['translationsNS'],
defaultNS: 'translationsNS',
interpolation: {
escapeValue: false
},
resources: { en: { translationsNS: {} } }
})
}