MCPcopy Index your code
hub / github.com/TanStack/router / createEdgeCaseTestRouter

Function createEdgeCaseTestRouter

packages/solid-router/tests/navigate.test.tsx:1139–1165  ·  view source on GitHub ↗
(initialHistory?: RouterHistory)

Source from the content-addressed store, hash-verified

1137
1138describe('router.navigate navigation using optional path parameters - edge cases and validations', () => {
1139 function createEdgeCaseTestRouter(initialHistory?: RouterHistory) {
1140 const history =
1141 initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })
1142
1143 const rootRoute = createRootRoute({})
1144 const indexRoute = createRoute({
1145 getParentRoute: () => rootRoute,
1146 path: '/',
1147 })
1148
1149 // Route with prefix/suffix
1150 const filesRoute = createRoute({
1151 getParentRoute: () => rootRoute,
1152 path: '/files/prefix{-$name}.txt',
1153 })
1154
1155 // Route with all optional params
1156 const dateRoute = createRoute({
1157 getParentRoute: () => rootRoute,
1158 path: '/date/{-$year}/{-$month}/{-$day}',
1159 })
1160
1161 const routeTree = rootRoute.addChildren([indexRoute, filesRoute, dateRoute])
1162 const router = createRouter({ routeTree, history })
1163
1164 return { router }
1165 }
1166
1167 it('should handle optional parameters with prefix/suffix correctly', async () => {
1168 const { router } = createEdgeCaseTestRouter(

Callers 1

navigate.test.tsxFile · 0.70

Calls 4

createMemoryHistoryFunction · 0.90
createRootRouteFunction · 0.90
createRouteFunction · 0.90
createRouterFunction · 0.90

Tested by

no test coverage detected