@@ -199,7 +199,8 @@ describe('applyRedirects', () => {
199199 return of ( loadedConfig ) ;
200200 }
201201 } ;
202- const config : Routes = [ { path : 'a' , component : ComponentA , loadChildren : 'children' } ] ;
202+ const config : Routes =
203+ [ { path : 'a' , component : ComponentA , loadChildren : jasmine . createSpy ( 'children' ) } ] ;
203204
204205 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'a/b' ) , config )
205206 . forEach ( r => {
@@ -212,7 +213,8 @@ describe('applyRedirects', () => {
212213 const loader = {
213214 load : ( p : any ) => new Observable < any > ( ( obs : any ) => obs . error ( new Error ( 'Loading Error' ) ) )
214215 } ;
215- const config = [ { path : 'a' , component : ComponentA , loadChildren : 'children' } ] ;
216+ const config =
217+ [ { path : 'a' , component : ComponentA , loadChildren : jasmine . createSpy ( 'children' ) } ] ;
216218
217219 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'a/b' ) , config )
218220 . subscribe ( ( ) => { } , ( e ) => {
@@ -229,9 +231,12 @@ describe('applyRedirects', () => {
229231 get : ( token : any ) => token === 'guard1' || token === 'guard2' ? guard : { injector}
230232 } ;
231233
232- const config = [
233- { path : 'a' , component : ComponentA , canLoad : [ 'guard1' , 'guard2' ] , loadChildren : 'children' }
234- ] ;
234+ const config = [ {
235+ path : 'a' ,
236+ component : ComponentA ,
237+ canLoad : [ 'guard1' , 'guard2' ] ,
238+ loadChildren : jasmine . createSpy ( 'children' )
239+ } ] ;
235240
236241 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config ) . forEach ( r => {
237242 expectTreeToBe ( r , '/a/b' ) ;
@@ -257,9 +262,12 @@ describe('applyRedirects', () => {
257262 }
258263 } ;
259264
260- const config = [
261- { path : 'a' , component : ComponentA , canLoad : [ 'guard1' , 'guard2' ] , loadChildren : 'children' }
262- ] ;
265+ const config = [ {
266+ path : 'a' ,
267+ component : ComponentA ,
268+ canLoad : [ 'guard1' , 'guard2' ] ,
269+ loadChildren : jasmine . createSpy ( 'children' )
270+ } ] ;
263271
264272 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config )
265273 . subscribe (
@@ -291,9 +299,12 @@ describe('applyRedirects', () => {
291299 }
292300 } ;
293301
294- const config = [
295- { path : 'a' , component : ComponentA , canLoad : [ 'guard1' , 'guard2' ] , loadChildren : 'children' }
296- ] ;
302+ const config = [ {
303+ path : 'a' ,
304+ component : ComponentA ,
305+ canLoad : [ 'guard1' , 'guard2' ] ,
306+ loadChildren : jasmine . createSpy ( 'children' )
307+ } ] ;
297308
298309 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config )
299310 . subscribe (
@@ -312,8 +323,12 @@ describe('applyRedirects', () => {
312323 const guard = { canLoad : ( ) => Promise . resolve ( true ) } ;
313324 const injector = { get : ( token : any ) => token === 'guard' ? guard : { injector} } ;
314325
315- const config =
316- [ { path : 'a' , component : ComponentA , canLoad : [ 'guard' ] , loadChildren : 'children' } ] ;
326+ const config = [ {
327+ path : 'a' ,
328+ component : ComponentA ,
329+ canLoad : [ 'guard' ] ,
330+ loadChildren : jasmine . createSpy ( 'children' )
331+ } ] ;
317332
318333 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config )
319334 . subscribe (
@@ -337,8 +352,12 @@ describe('applyRedirects', () => {
337352 } ;
338353 const injector = { get : ( token : any ) => token === 'guard' ? guard : { injector} } ;
339354
340- const config =
341- [ { path : 'a' , component : ComponentA , canLoad : [ 'guard' ] , loadChildren : 'children' } ] ;
355+ const config = [ {
356+ path : 'a' ,
357+ component : ComponentA ,
358+ canLoad : [ 'guard' ] ,
359+ loadChildren : jasmine . createSpy ( 'children' )
360+ } ] ;
342361
343362 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config )
344363 . subscribe (
@@ -367,8 +386,12 @@ describe('applyRedirects', () => {
367386 } ;
368387 const injector = { get : ( token : any ) => token === 'guard' ? guard : { injector} } ;
369388
370- const config =
371- [ { path : 'a' , component : ComponentA , canLoad : [ 'guard' ] , loadChildren : 'children' } ] ;
389+ const config = [ {
390+ path : 'a' ,
391+ component : ComponentA ,
392+ canLoad : [ 'guard' ] ,
393+ loadChildren : jasmine . createSpy ( 'children' )
394+ } ] ;
372395
373396 applyRedirects ( < any > injector , < any > loader , serializer , tree ( 'a/b' ) , config )
374397 . subscribe (
@@ -388,8 +411,10 @@ describe('applyRedirects', () => {
388411
389412 const loader = { load : ( injector : any , p : any ) => of ( loadedConfig ) } ;
390413
391- const config : Routes =
392- [ { path : '' , pathMatch : 'full' , redirectTo : '/a' } , { path : 'a' , loadChildren : 'children' } ] ;
414+ const config : Routes = [
415+ { path : '' , pathMatch : 'full' , redirectTo : '/a' } ,
416+ { path : 'a' , loadChildren : jasmine . createSpy ( 'children' ) }
417+ ] ;
393418
394419 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( '' ) , config ) . forEach ( r => {
395420 expectTreeToBe ( r , 'a' ) ;
@@ -409,7 +434,7 @@ describe('applyRedirects', () => {
409434 }
410435 } ;
411436
412- const config : Routes = [ { path : 'a' , loadChildren : 'children' } ] ;
437+ const config : Routes = [ { path : 'a' , loadChildren : jasmine . createSpy ( 'children' ) } ] ;
413438
414439 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'a?k1' ) , config )
415440 . subscribe ( r => { } ) ;
@@ -430,7 +455,7 @@ describe('applyRedirects', () => {
430455
431456 const loader = { load : ( injector : any , p : any ) => of ( loadedConfig ) } ;
432457
433- const config : Routes = [ { path : '**' , loadChildren : 'children' } ] ;
458+ const config : Routes = [ { path : '**' , loadChildren : jasmine . createSpy ( 'children' ) } ] ;
434459
435460 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'xyz' ) , config )
436461 . forEach ( r => {
@@ -445,14 +470,14 @@ describe('applyRedirects', () => {
445470 loader . load . and . returnValue ( of ( loadedConfig ) . pipe ( delay ( 0 ) ) ) ;
446471
447472 const config : Routes = [
448- { path : '' , loadChildren : 'matchChildren' } ,
449- { path : '**' , loadChildren : 'children' } ,
473+ { path : '' , loadChildren : jasmine . createSpy ( 'matchChildren' ) } ,
474+ { path : '**' , loadChildren : jasmine . createSpy ( 'children' ) } ,
450475 ] ;
451476
452477 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( '' ) , config ) . forEach ( r => {
453478 expect ( loader . load . calls . count ( ) ) . toEqual ( 1 ) ;
454479 expect ( loader . load . calls . first ( ) . args ) . not . toContain ( jasmine . objectContaining ( {
455- loadChildren : 'children'
480+ loadChildren : jasmine . createSpy ( 'children' )
456481 } ) ) ;
457482 } ) ;
458483 } ) ;
@@ -462,8 +487,10 @@ describe('applyRedirects', () => {
462487
463488 const loader = { load : ( injector : any , p : any ) => of ( loadedConfig ) } ;
464489
465- const config : Routes =
466- [ { path : 'not-found' , loadChildren : 'children' } , { path : '**' , redirectTo : 'not-found' } ] ;
490+ const config : Routes = [
491+ { path : 'not-found' , loadChildren : jasmine . createSpy ( 'children' ) } ,
492+ { path : '**' , redirectTo : 'not-found' }
493+ ] ;
467494
468495 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'xyz' ) , config )
469496 . forEach ( r => {
@@ -476,8 +503,10 @@ describe('applyRedirects', () => {
476503
477504 const loader = { load : ( injector : any , p : any ) => of ( loadedConfig ) } ;
478505
479- const config : Routes =
480- [ { path : 'not-found' , loadChildren : 'children' } , { path : '**' , redirectTo : '/not-found' } ] ;
506+ const config : Routes = [
507+ { path : 'not-found' , loadChildren : jasmine . createSpy ( 'children' ) } ,
508+ { path : '**' , redirectTo : '/not-found' }
509+ ] ;
481510
482511 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'xyz' ) , config )
483512 . forEach ( r => {
@@ -497,13 +526,15 @@ describe('applyRedirects', () => {
497526 return of ( loadedConfig )
498527 . pipe (
499528 delay ( 100 * loadCalls ) ,
500- tap ( ( ) => loaded . push ( p . loadChildren ! as string ) ) ,
529+ tap ( ( ) => loaded . push ( ( p . loadChildren as jasmine . Spy ) . and . identity ) ) ,
501530 ) ;
502531 }
503532 } ;
504533
505- const config : Routes =
506- [ { path : '' , loadChildren : 'root' } , { path : '' , loadChildren : 'aux' , outlet : 'popup' } ] ;
534+ const config : Routes = [
535+ { path : '' , loadChildren : jasmine . createSpy ( 'root' ) } ,
536+ { path : '' , loadChildren : jasmine . createSpy ( 'aux' ) , outlet : 'popup' }
537+ ] ;
507538
508539 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( '' ) , config ) . subscribe ( ) ;
509540 expect ( loadCalls ) . toBe ( 1 ) ;
@@ -526,13 +557,13 @@ describe('applyRedirects', () => {
526557 return of ( loadedConfig )
527558 . pipe (
528559 delay ( 100 * loadCalls ) ,
529- tap ( ( ) => loaded . push ( p . loadChildren ! as string ) ) ,
560+ tap ( ( ) => loaded . push ( ( p . loadChildren as jasmine . Spy ) . and . identity ) ) ,
530561 ) ;
531562 }
532563 } ;
533564
534565 const config : Routes = [
535- { path : '**' , loadChildren : 'children' } ,
566+ { path : '**' , loadChildren : jasmine . createSpy ( 'children' ) } ,
536567 ] ;
537568
538569 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'xyz/a' ) , config )
@@ -562,13 +593,15 @@ describe('applyRedirects', () => {
562593 loadCalls ++ ;
563594 return of ( loadedConfig )
564595 . pipe (
565- tap ( ( ) => loaded . push ( p . loadChildren ! as string ) ) ,
596+ tap ( ( ) => loaded . push ( ( p . loadChildren as jasmine . Spy ) . and . identity ) ) ,
566597 ) ;
567598 }
568599 } ;
569600
570- const config : Routes =
571- [ { path : 'a' , loadChildren : 'first' } , { path : 'a' , loadChildren : 'second' } ] ;
601+ const config : Routes = [
602+ { path : 'a' , loadChildren : jasmine . createSpy ( 'first' ) } ,
603+ { path : 'a' , loadChildren : jasmine . createSpy ( 'second' ) }
604+ ] ;
572605
573606 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( 'a' ) , config ) . subscribe ( ) ;
574607 expect ( loadCalls ) . toBe ( 1 ) ;
@@ -584,19 +617,20 @@ describe('applyRedirects', () => {
584617 const auxDelay = 1 ;
585618 const loader = {
586619 load : ( injector : any , p : Route ) => {
587- const delayMs = p . loadChildren ! as string === 'aux' ? auxDelay : rootDelay ;
620+ const delayMs =
621+ ( p . loadChildren ! as jasmine . Spy ) . and . identity === 'aux' ? auxDelay : rootDelay ;
588622 return of ( loadedConfig )
589623 . pipe (
590624 delay ( delayMs ) ,
591- tap ( ( ) => loaded . push ( p . loadChildren ! as string ) ) ,
625+ tap ( ( ) => loaded . push ( ( p . loadChildren as jasmine . Spy ) . and . identity ) ) ,
592626 ) ;
593627 }
594628 } ;
595629
596630 const config : Routes = [
597631 // Define aux route first so it matches before the primary outlet
598- { path : 'modal' , loadChildren : 'aux' , outlet : 'popup' } ,
599- { path : '' , loadChildren : 'root' } ,
632+ { path : 'modal' , loadChildren : jasmine . createSpy ( 'aux' ) , outlet : 'popup' } ,
633+ { path : '' , loadChildren : jasmine . createSpy ( 'root' ) } ,
600634 ] ;
601635
602636 applyRedirects ( testModule . injector , < any > loader , serializer , tree ( '(popup:modal)' ) , config )
0 commit comments