scottrippey / next-router-mock

Mock implementation of the Next.js Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not support hash routes

kamranayub opened this issue · comments

In next/router proper, I am seeing asPath values that include the URL hash as I expect. However, passing hashes to next-router-mock is removing hashes. It looks like the pathing logic only deals with pathname and query but doesn't preserve hash so my tests are "passing" even though at runtime the behavior is different (and failing) causing a false-positive test suite.

router.push('/page#hash=true');
router.push(new URL('/page#hash=true', 'https://www.google.com'));

console.log(asPath);
// logs: "/page"

Fixed in 0.6.3!

You the best!