MCPcopy
hub / github.com/TanStack/router / createTestRouter

Function createTestRouter

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

Source from the content-addressed store, hash-verified

15})
16
17function createTestRouter(initialHistory?: RouterHistory) {
18 const history =
19 initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })
20
21 const rootRoute = createRootRoute({})
22 const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: '/' })
23 const postsRoute = createRoute({
24 getParentRoute: () => rootRoute,
25 path: '/posts',
26 })
27 const postIdRoute = createRoute({
28 getParentRoute: () => postsRoute,
29 path: '/$slug',
30 })
31 const projectRoute = createRoute({
32 getParentRoute: () => rootRoute,
33 path: '/p',
34 })
35 const projectIdRoute = createRoute({
36 getParentRoute: () => projectRoute,
37 path: '/$projectId',
38 })
39 const projectVersionRoute = createRoute({
40 getParentRoute: () => projectIdRoute,
41 path: '/$version',
42 })
43 const projectFrameRoute = createRoute({
44 getParentRoute: () => projectVersionRoute,
45 path: '/$framework',
46 })
47
48 const uRoute = createRoute({
49 getParentRoute: () => rootRoute,
50 path: '/u',
51 })
52 const uLayoutRoute = createRoute({
53 id: '_layout',
54 getParentRoute: () => uRoute,
55 })
56 const uUsernameRoute = createRoute({
57 getParentRoute: () => uLayoutRoute,
58 path: '$username',
59 })
60
61 const gRoute = createRoute({
62 getParentRoute: () => rootRoute,
63 path: '/g',
64 })
65 const gLayoutRoute = createRoute({
66 id: 'layout',
67 getParentRoute: () => gRoute,
68 })
69 const gUsernameRoute = createRoute({
70 getParentRoute: () => gLayoutRoute,
71 path: '$username',
72 })
73 const searchRoute = createRoute({
74 getParentRoute: () => rootRoute,

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