QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.19k stars 52 forks source link

Use of I18nProviderClient in jest tests #348

Closed murphcfa closed 4 months ago

murphcfa commented 5 months ago

Describe the bug

Error thrown when using I18nProviderClient in a jest test

To Reproduce Steps to reproduce the behavior:

  1. Create client component that is wrapped in the I18nProviderClient
  2. Create jest test for component and wrap component in I18nProviderClient within the test
  3. See error TypeError: (0 , import_react.use) is not a function

Expected behavior Test would pass

Screenshots

Screenshot 2024-02-08 at 3 58 07 PM

Screenshot 2024-02-08 at 3 57 58 PM

About (please complete the following information):

Additional context

I am trying to write a jest test for a component that leverages the I18nProviderClient but am seeing some errors. I imagine this is due to something I have configured incorrectly, however, due to no examples being provided for unit testing I am unsure how you would properly set this up. Has anyone else experienced this?

QuiiBz commented 4 months ago

Closing as duplicate of https://github.com/QuiiBz/next-international/issues/178 - I believe we haven't found yet a proper solution to test Next.js App Router with the new React features.