@@ -176,54 +176,6 @@ describe('addRoutesToAllRoutes', () => {
176176 } ) ;
177177 } ) ;
178178
179- it ( 'should preserve nested children on parent routes without creating duplicate top-level entries' , ( ) => {
180- const routes = [
181- { path : '/' , element : < div /> } ,
182- { path : '/user/:id' , element : < div /> } ,
183- { path : '/group/:group/:user?' , element : < div /> } ,
184- {
185- path : '/v2/post/:post' ,
186- element : < div /> ,
187- children : [
188- { index : true , element : < div /> } ,
189- { path : 'featured' , element : < div /> } ,
190- { path : '/v2/post/:post/related' , element : < div /> } ,
191- ] ,
192- } ,
193- ] ;
194-
195- addRoutesToAllRoutes ( routes ) ;
196- const allRoutesArr = Array . from ( allRoutes ) ;
197-
198- // Should have all routes flattened (parent + all descendants)
199- expect ( allRoutesArr . length ) . toBeGreaterThanOrEqual ( 4 ) ;
200-
201- // Find the parent route
202- const parentRoute = allRoutesArr . find ( ( r : any ) => r . path === '/v2/post/:post' ) ;
203- expect ( parentRoute ) . toBeTruthy ( ) ;
204- expect ( parentRoute ! . children ) . toBeDefined ( ) ;
205- expect ( Array . isArray ( parentRoute ! . children ) ) . toBe ( true ) ;
206- expect ( parentRoute ! . children ) . toHaveLength ( 3 ) ;
207-
208- // Verify children structure is preserved
209- expect ( parentRoute ! . children ) . toEqual (
210- expect . arrayContaining ( [
211- expect . objectContaining ( { index : true } ) ,
212- expect . objectContaining ( { path : 'featured' } ) ,
213- expect . objectContaining ( { path : '/v2/post/:post/related' } ) ,
214- ] ) ,
215- ) ;
216-
217- // Verify that children are NOT in allRoutes as individual entries
218- expect ( allRoutesArr ) . not . toEqual (
219- expect . arrayContaining ( [
220- expect . objectContaining ( { index : true } ) ,
221- expect . objectContaining ( { path : 'featured' } ) ,
222- expect . objectContaining ( { path : '/v2/post/:post/related' } ) ,
223- ] ) ,
224- ) ;
225- } ) ;
226-
227179 it ( 'should handle complex nested routes with multiple levels' , ( ) => {
228180 const routes = [
229181 { path : '/' , element : < div /> } ,
@@ -338,7 +290,6 @@ describe('addRoutesToAllRoutes', () => {
338290 addRoutesToAllRoutes ( routes ) ;
339291 const allRoutesArr = Array . from ( allRoutes ) ;
340292
341- // Verify all routes are flattened into allRoutes
342293 expect ( allRoutesArr ) . toEqual ( [
343294 {
344295 path : '/' ,
0 commit comments