@@ -12,11 +12,10 @@ type RouteMatch = { readonly routeId: string; readonly params: Record<string, st
1212type SpikeRouter = {
1313 matchRoutes ( pathname : string ) : ReadonlyArray < RouteMatch > ;
1414 buildLocation ( options : unknown ) : { readonly href : string } ;
15- navigate ( options : unknown ) : Promise < void > ;
1615 load ( ) : Promise < void > ;
1716} ;
1817
19- const make = ( ) : SpikeRouter => {
18+ const make = ( initialPath = "/" ) : SpikeRouter => {
2019 const rootRoute = createRootRoute ( ) ;
2120 const orgScope = createRoute ( {
2221 getParentRoute : ( ) => rootRoute ,
@@ -38,7 +37,7 @@ const make = (): SpikeRouter => {
3837 // oxlint-disable-next-line executor/no-double-cast -- boundary: a test-local route tree must escape the package-global router Register types
3938 return createRouter ( {
4039 routeTree,
41- history : createMemoryHistory ( { initialEntries : [ "/" ] } ) ,
40+ history : createMemoryHistory ( { initialEntries : [ initialPath ] } ) ,
4241 } ) as unknown as SpikeRouter ;
4342} ;
4443
@@ -84,8 +83,9 @@ describe("optional org-slug segment", () => {
8483 } ) ;
8584
8685 it ( "inherits the slug param on relative navigations" , async ( ) => {
87- const router = make ( ) ;
88- await router . navigate ( { to : "/{-$orgSlug}" , params : { orgSlug : "acme" } } ) ;
86+ // Start on the slugged URL: without a DOM the router runs in server mode,
87+ // where navigate() does not move the location.
88+ const router = make ( "/acme" ) ;
8989 await router . load ( ) ;
9090 // A link that only supplies its own params keeps the current orgSlug.
9191 const href = router . buildLocation ( {
0 commit comments