From 8be6b12c2bc0b313f87e0a9d454ad174b5b285cb Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Tue, 9 Aug 2016 16:20:26 +0200 Subject: [PATCH] test(router): use Object.isFrozen instead of relying on an exception --- modules/@angular/router/test/recognize.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/@angular/router/test/recognize.spec.ts b/modules/@angular/router/test/recognize.spec.ts index 7e1cc12250..fd84b55a29 100644 --- a/modules/@angular/router/test/recognize.spec.ts +++ b/modules/@angular/router/test/recognize.spec.ts @@ -24,7 +24,7 @@ describe('recognize', () => { checkRecognize([{path: 'a/:id', component: ComponentA}], 'a/10', (s: RouterStateSnapshot) => { checkActivatedRoute(s.root, '', {}, RootComponent); const child = s.firstChild(s.root); - expect(() => child.params['prop'] = 'new').toThrowError(/Can't add property/); + expect(Object.isFrozen(child.params)).toBeTruthy(); }); }); @@ -637,7 +637,7 @@ describe('recognize', () => { it('should freeze query params object', () => { checkRecognize([{path: 'a', component: ComponentA}], 'a?q=11', (s: RouterStateSnapshot) => { - expect(() => s.queryParams['prop'] = 'new').toThrowError(/Can't add property/); + expect(Object.isFrozen(s.queryParams)).toBeTruthy(); }); }); });