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

Function setup

packages/router-core/tests/callbacks.test.ts:6–41  ·  view source on GitHub ↗
({
    onEnter,
    onLeave,
    onStay,
  }: {
    onEnter?: () => void
    onLeave?: () => void
    onStay?: () => void
  })

Source from the content-addressed store, hash-verified

4
5describe('callbacks', () => {
6 const setup = ({
7 onEnter,
8 onLeave,
9 onStay,
10 }: {
11 onEnter?: () => void
12 onLeave?: () => void
13 onStay?: () => void
14 }) => {
15 const rootRoute = new BaseRootRoute({})
16
17 const fooRoute = new BaseRoute({
18 getParentRoute: () => rootRoute,
19 path: '/foo',
20 onLeave,
21 onEnter,
22 onStay,
23 })
24
25 const barRoute = new BaseRoute({
26 getParentRoute: () => rootRoute,
27 path: '/bar',
28 onLeave,
29 onEnter,
30 onStay,
31 })
32
33 const routeTree = rootRoute.addChildren([fooRoute, barRoute])
34
35 const router = new RouterCore({
36 routeTree,
37 history: createMemoryHistory(),
38 })
39
40 return router
41 }
42
43 const createFooRouter = (
44 opts: {

Callers 1

callbacks.test.tsFile · 0.70

Calls 1

createMemoryHistoryFunction · 0.90

Tested by

no test coverage detected