Skip to content
Source
Sign inSign up
TanStack/router

test(react-router): route matching failing when the basepath matches a route path in the tree #2020

ClosedSeanCassierewants to merge 5 commits intomain fromrefs/pull/2020/headopened

Showing 1 changed file with 61 additions and 1 deletion.

x
0 of 1 viewed, 1 left
61 additions and 1 deletionpackages/react-router/tests/link.test.tsxModified
View file
@@ -360,7 +360,7 @@
expect(postsLink).toHaveAttribute('href', '/posts')
​
- test('when navigating to /posts with a base url', async () => {
+ test('when navigating to /posts with a base url of /app', async () => {
const rootRoute = createRootRoute()
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
@@ -419,6 +419,66 @@
expect(postsLink).toHaveAttribute('href', '/app/posts')
​
+ test('when navigating to /posts with a base url of /posts', async () => {
+ const rootRoute = createRootRoute()
+ const indexRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: '/',
+ component: () => {
+ return (
+ <>
+ <h1>Index</h1>
+ <Link to="/">Index</Link>
+ <Link to="/posts">Posts</Link>
+ </>