test(router): use Object.isFrozen instead of relying on an exception
This commit is contained in:
parent
4728f29f67
commit
8be6b12c2b
|
@ -24,7 +24,7 @@ describe('recognize', () => {
|
||||||
checkRecognize([{path: 'a/:id', component: ComponentA}], 'a/10', (s: RouterStateSnapshot) => {
|
checkRecognize([{path: 'a/:id', component: ComponentA}], 'a/10', (s: RouterStateSnapshot) => {
|
||||||
checkActivatedRoute(s.root, '', {}, RootComponent);
|
checkActivatedRoute(s.root, '', {}, RootComponent);
|
||||||
const child = s.firstChild(s.root);
|
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', () => {
|
it('should freeze query params object', () => {
|
||||||
checkRecognize([{path: 'a', component: ComponentA}], 'a?q=11', (s: RouterStateSnapshot) => {
|
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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue