fix(di): improve error messages for invalid bindings

Fixes #1515

Closes #1573
This commit is contained in:
Pawel Kozlowski
2015-04-28 14:24:20 +02:00
committed by Misko Hevery
parent c0f3778dda
commit ee1b574baf
3 changed files with 7 additions and 4 deletions

View File

@ -205,8 +205,11 @@ export function main() {
});
it('should throw when given invalid bindings', function () {
expect(() => Injector.resolveAndCreate(["blah"])).toThrowError('Invalid binding blah');
expect(() => Injector.resolveAndCreate([bind("blah")])).toThrowError('Invalid binding blah');
expect(() => Injector.resolveAndCreate(["blah"]))
.toThrowError('Invalid binding - only instances of Binding and Type are allowed, got: blah');
expect(() => Injector.resolveAndCreate([bind("blah")]))
.toThrowError('Invalid binding - only instances of Binding and Type are allowed, ' +
'got: BindingBuilder with blah token');
});
it('should provide itself', function () {