next-router-mock
next-router-mock copied to clipboard
Consider the skipTrailingSlashRedirect config
In my next.config.js I have skipTrailingSlashRedirect: true, i.e. the URLs should retain their trailing slash. next-router-mock however seems to trim the trailing slash from all URLs.
This fails:
// Component
router.push('/foo/')
// Test
const spy = jest.fn()
render(<MemoryRouterProvider onPush={spy}><Component /></MemoryRouterProvider)
expect(spy).toHaveBeenCalledWith('/foo/') // Instead, it is called with /foo
I'm able to fix this by patching the package (I changed normalizeTrailingSlash()), but it would be cool to have first class support.
This sounds like a good idea, I will try to add support. PRs are welcome though, if you have a fix or some unit tests!