fix(router): fixes a type issue in a test

This commit is contained in:
vsavkin 2016-06-16 15:38:10 -07:00
parent b260eb06f6
commit fea216db12
1 changed files with 15 additions and 10 deletions

View File

@ -4,17 +4,19 @@ describe('config', () => {
describe("validateConfig", () => { describe("validateConfig", () => {
it("should not throw when no errors", () => { it("should not throw when no errors", () => {
validateConfig([ validateConfig([
{ path: '', redirectTo: 'b' }, {path: '', redirectTo: 'b'},
{ path: 'b', component: ComponentA } {path: 'b', component: ComponentA}
]); ]);
}); });
it("should throw when redirectTo and children are used together", () => { it("should throw when redirectTo and children are used together", () => {
expect(() => { expect(() => {
validateConfig([ validateConfig([
{ path: 'a', redirectTo: 'b', children: [ {
path: 'a', redirectTo: 'b', children: [
{path: 'b', component: ComponentA} {path: 'b', component: ComponentA}
] } ]
}
]); ]);
}).toThrowError(`Invalid configuration of route 'a': redirectTo and children cannot be used together`); }).toThrowError(`Invalid configuration of route 'a': redirectTo and children cannot be used together`);
}); });
@ -22,7 +24,7 @@ describe('config', () => {
it("should throw when component and redirectTo are used together", () => { it("should throw when component and redirectTo are used together", () => {
expect(() => { expect(() => {
validateConfig([ validateConfig([
{ path: 'a', component: ComponentA, redirectTo: 'b' } {path: 'a', component: ComponentA, redirectTo: 'b'}
]); ]);
}).toThrowError(`Invalid configuration of route 'a': redirectTo and component cannot be used together`); }).toThrowError(`Invalid configuration of route 'a': redirectTo and component cannot be used together`);
}); });
@ -30,7 +32,7 @@ describe('config', () => {
it("should throw when path is missing", () => { it("should throw when path is missing", () => {
expect(() => { expect(() => {
validateConfig([ validateConfig([
{ component: '', redirectTo: 'b' } {component: '', redirectTo: 'b'}
]); ]);
}).toThrowError(`Invalid route configuration: routes must have path specified`); }).toThrowError(`Invalid route configuration: routes must have path specified`);
}); });
@ -38,13 +40,16 @@ describe('config', () => {
it("should throw when path starts with a slash", () => { it("should throw when path starts with a slash", () => {
expect(() => { expect(() => {
validateConfig([ validateConfig([
{ path: '/a', componenta: '', redirectTo: 'b' } <any>{path: '/a', componenta: '', redirectTo: 'b'}
]); ]);
}).toThrowError(`Invalid route configuration of route '/a': path cannot start with a slash`); }).toThrowError(`Invalid route configuration of route '/a': path cannot start with a slash`);
}); });
}); });
}); });
class ComponentA {} class ComponentA {
class ComponentB {} }
class ComponentC {} class ComponentB {
}
class ComponentC {
}