scottrippey / next-router-mock

Mock implementation of the Next.js Router
MIT License
400 stars 38 forks source link

next/link not working with async #111

Closed phil-tutti closed 9 months ago

phil-tutti commented 1 year ago

Hello,

while implementing next-router-mock into our testing setup, we realized that navigation with next/link does not work when using async.

I created a small reproduction repository (https://github.com/phil-tutti/next-link-repro), where we use next.js 13.5.6 and the latest next-router-mock (0.9.10). If you check it out and run yarn test or npm run test, you'll see the test fail, because the path is not as expected. When you remove async from both the import and MemoryRouterProvider, it works. I created the repro based on the documentation of this repository.

Thanks for your help

scottrippey commented 9 months ago

This should be fixed by the latest version. Please let me know if that works!

phil-tutti commented 9 months ago

it is indeed fixed, thanks