Skip to content
Source
Sign inSign up
TanStack/router

tests: reproducer for #2450 #2460

Closedschiller-manuel(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromreproducer-2450opened

Showing 1 changed file with 30 additions and 0 deletions.

x
0 of 1 viewed, 1 left
30 additions and 0 deletionspackages/react-router/tests/router.test.tsxModified
View file
@@ -7,6 +7,7 @@
screen,
waitFor,
} from '@testing-library/react'
+import { z } from 'zod'
import {
Link,
Outlet,
@@ -74,6 +75,17 @@
path: '$',
})
​
+ const routeWithParamsParseStringify = createRoute({
+ getParentRoute: () => rootRoute,
+ path: '/paramsParseStringify/$id',
+ params: {
+ parse: (params) => ({
+ id: z.number().int().parse(Number(params.id)),
+ }),
+ stringify: ({ id }) => ({ id: `${id}` }),
+ },
+ })
+​
const routeTree = rootRoute.addChildren([
indexRoute,