@@ -5625,30 +5625,54 @@ describe('Integration', () => {
5625
5625
} ) ;
5626
5626
5627
5627
describe ( 'Testing router options' , ( ) => {
5628
- describe ( 'paramsInheritanceStrategy' , ( ) => {
5629
- beforeEach ( ( ) => {
5628
+ describe ( 'should configure the router' , ( ) => {
5629
+ it ( 'assigns errorHandler' , ( ) => {
5630
+ function errorHandler ( error : any ) {
5631
+ throw error ;
5632
+ }
5630
5633
TestBed . configureTestingModule (
5631
- { imports : [ RouterTestingModule . withRoutes ( [ ] , { paramsInheritanceStrategy : 'always' } ) ] } ) ;
5634
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { errorHandler} ) ] } ) ;
5635
+ const router : Router = TestBed . inject ( Router ) ;
5636
+ expect ( router . errorHandler ) . toBe ( errorHandler ) ;
5632
5637
} ) ;
5633
5638
5634
- it ( 'should configure the router' , fakeAsync ( inject ( [ Router ] , ( router : Router ) => {
5635
- expect ( router . paramsInheritanceStrategy ) . toEqual ( 'always' ) ;
5636
- } ) ) ) ;
5637
- } ) ;
5639
+ it ( 'assigns malformedUriErrorHandler' , ( ) => {
5640
+ function malformedUriErrorHandler ( e : URIError , urlSerializer : UrlSerializer , url : string ) {
5641
+ return urlSerializer . parse ( '/error' ) ;
5642
+ }
5643
+ TestBed . configureTestingModule (
5644
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { malformedUriErrorHandler} ) ] } ) ;
5645
+ const router : Router = TestBed . inject ( Router ) ;
5646
+ expect ( router . malformedUriErrorHandler ) . toBe ( malformedUriErrorHandler ) ;
5647
+ } ) ;
5638
5648
5639
- describe ( 'malformedUriErrorHandler' , ( ) => {
5640
- function malformedUriErrorHandler ( e : URIError , urlSerializer : UrlSerializer , url : string ) {
5641
- return urlSerializer . parse ( '/error' ) ;
5642
- }
5649
+ it ( 'assigns onSameUrlNavigation' , ( ) => {
5650
+ TestBed . configureTestingModule (
5651
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { onSameUrlNavigation : 'reload' } ) ] } ) ;
5652
+ const router : Router = TestBed . inject ( Router ) ;
5653
+ expect ( router . onSameUrlNavigation ) . toBe ( 'reload' ) ;
5654
+ } ) ;
5643
5655
5644
- beforeEach ( ( ) => {
5656
+ it ( 'assigns paramsInheritanceStrategy' , ( ) => {
5645
5657
TestBed . configureTestingModule (
5646
- { imports : [ RouterTestingModule . withRoutes ( [ ] , { malformedUriErrorHandler} ) ] } ) ;
5658
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { paramsInheritanceStrategy : 'always' } ) ] } ) ;
5659
+ const router : Router = TestBed . inject ( Router ) ;
5660
+ expect ( router . paramsInheritanceStrategy ) . toBe ( 'always' ) ;
5647
5661
} ) ;
5648
5662
5649
- it ( 'should configure the router' , fakeAsync ( inject ( [ Router ] , ( router : Router ) => {
5650
- expect ( router . malformedUriErrorHandler ) . toBe ( malformedUriErrorHandler ) ;
5651
- } ) ) ) ;
5663
+ it ( 'assigns relativeLinkResolution' , ( ) => {
5664
+ TestBed . configureTestingModule (
5665
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { relativeLinkResolution : 'corrected' } ) ] } ) ;
5666
+ const router : Router = TestBed . inject ( Router ) ;
5667
+ expect ( router . relativeLinkResolution ) . toBe ( 'corrected' ) ;
5668
+ } ) ;
5669
+
5670
+ it ( 'assigns urlUpdateStrategy' , ( ) => {
5671
+ TestBed . configureTestingModule (
5672
+ { imports : [ RouterTestingModule . withRoutes ( [ ] , { urlUpdateStrategy : 'eager' } ) ] } ) ;
5673
+ const router : Router = TestBed . inject ( Router ) ;
5674
+ expect ( router . urlUpdateStrategy ) . toBe ( 'eager' ) ;
5675
+ } ) ;
5652
5676
} ) ;
5653
5677
} ) ;
5654
5678
0 commit comments