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

Function setup

packages/react-router/tests/router.test.tsx:980–1198  ·  view source on GitHub ↗
(opts?: {
    remountDeps: {
      default?: RemountDepsFn
      fooId?: RemountDepsFn
      foo2Id?: RemountDepsFn
      barId?: RemountDepsFn
      bar2Id?: RemountDepsFn
    }
  })

Source from the content-addressed store, hash-verified

978describe('router rendering stability', () => {
979 type RemountDepsFn = (opts: MakeRemountDepsOptionsUnion) => any
980 async function setup(opts?: {
981 remountDeps: {
982 default?: RemountDepsFn
983 fooId?: RemountDepsFn
984 foo2Id?: RemountDepsFn
985 barId?: RemountDepsFn
986 bar2Id?: RemountDepsFn
987 }
988 }) {
989 const mountMocks = {
990 fooId: vi.fn(),
991 foo2Id: vi.fn(),
992 barId: vi.fn(),
993 bar2Id: vi.fn(),
994 }
995
996 const rootRoute = createRootRoute({
997 component: () => {
998 return (
999 <div>
1000 <p>Root</p>
1001 <div>
1002 <Link
1003 data-testid="link-foo-1"
1004 to="/foo/$fooId"
1005 params={{ fooId: '1' }}
1006 >
1007 Foo1
1008 </Link>
1009 <Link
1010 data-testid="link-foo-2"
1011 to="/foo/$fooId"
1012 params={{ fooId: '2' }}
1013 >
1014 Foo2
1015 </Link>
1016 <Link
1017 data-testid="link-foo-3-bar-1"
1018 to="/foo/$fooId/bar/$barId"
1019 params={{ fooId: '3', barId: '1' }}
1020 >
1021 Foo3-Bar1
1022 </Link>
1023 <Link
1024 data-testid="link-foo-3-bar-2"
1025 to="/foo/$fooId/bar/$barId"
1026 params={{ fooId: '3', barId: '2' }}
1027 >
1028 Foo3-Bar2
1029 </Link>
1030 <Link
1031 data-testid="link-foo2-1-bar2-1"
1032 to="/foo2/$foo2Id/bar2/$bar2Id"
1033 params={{ foo2Id: '1', bar2Id: '1' }}
1034 >
1035 Foo2-1-Bar2_1
1036 </Link>
1037 <Link

Callers 1

router.test.tsxFile · 0.70

Calls 5

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

Tested by

no test coverage detected