@@ -5625,30 +5625,54 @@ describe('Integration', () => {
56255625} ) ;
56265626
56275627describe ( '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+ }
56305633 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 ) ;
56325637 } ) ;
56335638
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+ } ) ;
56385648
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+ } ) ;
56435655
5644- beforeEach ( ( ) => {
5656+ it ( 'assigns paramsInheritanceStrategy' , ( ) => {
56455657 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' ) ;
56475661 } ) ;
56485662
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+ } ) ;
56525676 } ) ;
56535677} ) ;
56545678
0 commit comments