From 1a64e07ec5ba3cbb0fbe162cd6141bee8d08c7fc Mon Sep 17 00:00:00 2001 From: nikolay-borzov Date: Mon, 21 Jan 2019 23:34:08 +0400 Subject: [PATCH] add WithNamespaces mocking example Typescript test --- test/typescript/testing.test.tsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/typescript/testing.test.tsx diff --git a/test/typescript/testing.test.tsx b/test/typescript/testing.test.tsx new file mode 100644 index 00000000..d8ac5c79 --- /dev/null +++ b/test/typescript/testing.test.tsx @@ -0,0 +1,30 @@ +import * as React from 'react' +import i18next from 'i18next' +import { translate, WithNamespaces } from "react-i18next"; + +interface ComponentProps extends WithNamespaces { } + +const Component: React.FC = (props) => { + const { t } = props; + + return + {t('test.key')} + +} + +const TranslatedComponent = translate()(Component) + +function describe(name: string, fn: () => void) {} +function test(name: string, fn: () => void) {} + +describe('translated component', () => { + test('renders correctly', () => { + const props: WithNamespaces = { + tReady: true, + i18n: i18next, + t: (key, options) => key + } + + return + }) +}) \ No newline at end of file