This repository was archived by the owner on Sep 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change 13
13
// limitations under the License.
14
14
15
15
import {
16
- RouterProvider ,
16
+ RouterContextProvider ,
17
17
createMemoryHistory ,
18
18
createRootRoute ,
19
19
createRoute ,
@@ -22,25 +22,15 @@ import {
22
22
23
23
const rootRoute = createRootRoute ( ) ;
24
24
const index = createRoute ( { getParentRoute : ( ) => rootRoute , path : "/" } ) ;
25
- rootRoute . addChildren ( [ index ] ) ;
26
25
27
26
const router = createRouter ( {
28
27
history : createMemoryHistory ( ) ,
29
- routeTree : rootRoute ,
28
+ routeTree : rootRoute . addChildren ( [ index ] ) ,
30
29
} ) ;
31
30
32
- const routerReady = router . load ( ) ;
33
- // Because we also use this in the stories, we need to make sure we call this only in tests
34
- if ( import . meta. vitest ) {
35
- // Make sure the router is ready before running any tests
36
- import ( "vitest" ) . then ( ( { beforeAll } ) =>
37
- beforeAll ( async ( ) => await routerReady ) ,
38
- ) ;
39
- }
40
-
41
31
export const DummyRouter : React . FC < React . PropsWithChildren > = ( {
42
32
children,
43
33
} ) => (
44
34
/** @ts -expect-error: The router we pass doesn't match the "real" router, which is fine for tests */
45
- < RouterProvider router = { router } defaultComponent = { ( ) => children } / >
35
+ < RouterContextProvider router = { router } > { children } </ RouterContextProvider >
46
36
) ;
You can’t perform that action at this time.
0 commit comments