feat(Router): add extra validation for when route was passed as Array (#9942)

This commit is contained in:
Hiroto Fukui
2016-07-15 00:28:31 +09:00
committed by Victor Berchet
parent 85be729c70
commit aa88438b54
2 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,15 @@ describe('config', () => {
validateConfig([{path: 'a', redirectTo: 'b'}, {path: 'b', component: ComponentA}]);
});
it('should throw when Array is passed', () => {
expect(() => {
validateConfig([
{path: 'a', component: ComponentA},
[{path: 'b', component: ComponentB}, {path: 'c', component: ComponentC}]
]);
}).toThrowError(`Invalid route configuration: Array cannot be specified`);
});
it('should throw when redirectTo and children are used together', () => {
expect(() => {
validateConfig(