Skip to content

Commit

Permalink
docs: Update dependencies, add test for scroll: false in router.push
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Nov 28, 2023
1 parent 9977adc commit 2a90509
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
"@types/negotiator": "^0.6.1",
"@types/node": "^17.0.23",
"@types/react": "18.2.34",
"eslint": "^8.46.0",
"eslint": "^8.54.0",
"eslint-config-molindo": "^7.0.0",
"eslint-plugin-deprecation": "^1.4.1",
"next": "14.0.3",
"next": "^14.0.3",
"path-to-regexp": "^6.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ describe('useRouter', () => {
expect(push).toHaveBeenCalledTimes(1);
expect(push).toHaveBeenCalledWith('/de/ueber-uns?foo=bar&bar=1&bar=2');
});

it('passes through unknown options to the Next.js router', () => {
function Component() {
const router = useRouter();
// @ts-expect-error -- Wait for https://github.com/vercel/next.js/pull/59001
router.push('/about', {locale: 'de', scroll: false});
return null;
}
render(<Component />);
const push = useNextRouter().push as Mock;
expect(push).toHaveBeenCalledTimes(1);
expect(push).toHaveBeenCalledWith('/de/ueber-uns', {scroll: false});
});
});

it('handles unknown routes', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ describe('useRouter', () => {
expect(push).toHaveBeenCalledTimes(1);
expect(push).toHaveBeenCalledWith('/de/about');
});

it('passes through unknown options to the Next.js router', () => {
function Component() {
const router = useRouter();
// @ts-expect-error -- Wait for https://github.com/vercel/next.js/pull/59001
router.push('/about', {locale: 'de', scroll: false});
return null;
}
render(<Component />);
const push = useNextRouter().push as Mock;
expect(push).toHaveBeenCalledTimes(1);
expect(push).toHaveBeenCalledWith('/de/about', {scroll: false});
});
});
});

Expand Down

0 comments on commit 2a90509

Please sign in to comment.