Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
React Testing Library: las traducciones de i18n no funcionan

Estoy tratando de probar un componente, aquí está el componente, simplificado:

 const Block = () => { const { t } = useTranslation(); return <p data-testid="text">{t('some.text')}</p>; }

Entonces tengo esta prueba:

 test('That the text is correct', () => { const wrapper = render( <I18nextProvider i18n={i18n}> <Block /> </I18nextProvider> ); expect(wrapper.getByTestId('text')).toHaveTextContent('Hello!'); });

El i18n es mi archivo de configuración, que se ve así:

 i18n .use(Backend) .use(initReactI18next) .init({ fallbackLng: 'en', lng: 'en' debug: false, react: { useSuspense: false, }, interpolation: { escapeValue: false, }, });

Pero todavía estoy recibiendo:

 Expect element to have text content: Hello! Received: some.text

Mi sospecha es que el complemento Backend es lo que hace que no funcione.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!