Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The test example from the documentation throws errors #441

Open
tillka opened this issue Jan 20, 2025 · 0 comments
Open

The test example from the documentation throws errors #441

tillka opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tillka
Copy link

tillka commented Jan 20, 2025

Description
All my unit tests failed after introducing next-international, so I followed the official documentation to build the custom renderer but this didn't work.

Then I tried out the example test from the documentation and it also fails.

I tried GitHub Copilot and o1 to help me or provide other examples but I couldn't get anything to work.

Can anyone share a working example for testing a component that includes next-international translations?

To Reproduce
Steps to reproduce the behavior:

  1. Follow official documentation
  2. Install Vitest, Testing-library
  3. Run test
  4. See error "Error: NextRouter was not mounted. https://nextjs.org/docs/messages/next-router-not-mounted on line 131: const { locale, defaultLocale, locales: nextLocales } = (0, import_router.useRouter)();"

About (please complete the following information):

  • next-international version ^1.3.1
  • Next.js version 14.2.4 (App Router)
@tillka tillka added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant