refactor(reflector): cleanup

This commit is contained in:
vsavkin 2014-10-07 10:42:27 -04:00
parent 7d566adea0
commit 5162b3c0ca
3 changed files with 13 additions and 19 deletions

View File

@ -36,7 +36,7 @@ export function main() {
expect(p).toBeFuture();
});
it('should return a future if the binding is sync', function () {
it('should return a future when the binding is sync', function () {
var injector = new Injector([
SynchronousUserList
]);
@ -44,6 +44,14 @@ export function main() {
expect(p).toBeFuture();
});
it("should return a future when the binding is sync (from cache)", function () {
var injector = new Injector([
UserList
]);
expect(injector.get(UserList)).toBeAnInstanceOf(UserList);
expect(injector.asyncGet(UserList)).toBeFuture();
});
it('should return the injector', function (done) {
var injector = new Injector([]);
var p = injector.asyncGet(Injector);
@ -67,14 +75,6 @@ export function main() {
});
});
it("should return a future when the binding is sync from cache", function () {
var injector = new Injector([
UserList
]);
expect(injector.get(UserList)).toBeAnInstanceOf(UserList);
expect(injector.asyncGet(UserList)).toBeFuture();
});
it("should create only one instance (async + async)", function (done) {
var injector = new Injector([
bind(UserList).toAsyncFactory([], fetchUsers)

View File

@ -24,15 +24,9 @@ class ListWrapper {
static forEach(list, fn) {
list.forEach(fn);
}
static first(List list) {
return list.first;
}
static last(List list) {
return list.last;
}
static List reversed(List list) {
return list.reversed.toList();
}
static first(List list) => list.first;
static last(List list) => list.last;
static List reversed(List list) => list.reversed.toList();
static void push(List l, e) { l.add(e); }
}

View File

@ -19,7 +19,7 @@ export function isBlank(obj):bool{
return obj == undefined || obj == null;
}
export function stringify(token) {
export function stringify(token):string {
if (typeof token === 'string') {
return token;
}