fix(di): allow dependencies as flat array

This commit is contained in:
mgechev
2015-10-27 17:45:24 -07:00
committed by vsavkin
parent c02f2bdab0
commit 6514b8ced0
2 changed files with 16 additions and 1 deletions
@@ -648,6 +648,15 @@ export function main() {
});
});
it('should allow declaring dependencies with flat arrays', () => {
var resolved =
Injector.resolve([bind('token').toFactory(e => e, [new InjectMetadata("dep")])]);
var nestedResolved =
Injector.resolve([bind('token').toFactory(e => e, [[new InjectMetadata("dep")]])]);
expect(resolved[0].resolvedFactories[0].dependencies[0].key.token)
.toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token);
});
describe("displayName", () => {
it("should work", () => {
expect(Injector.resolveAndCreate([Engine, BrokenEngine]).displayName)