How do you test for translations using Jest and Testing Library? #2083
Unanswered
SiavoushPerlego
asked this question in
Q&A
Replies: 1 comment 4 replies
-
maybe analogous to: https://react.i18next.com/misc/testing |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I wanted to know how I can test for actual translations using Jest and Testing Library. In my components, I am using the
useTranslation()
fromnext-i18next
like so.const { t } = useTranslation('<namespace>');
const text = t('<key>, { ns: '<namespace>', defaultValue: '<defaultValue> });
When rendering the component using Testing Library, only the key name appears in the component. How can I test so the component renders actual content and not the key name?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions