File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export function main() {
144144 . toThrowError ( 'Cannot instantiate UserList synchronously. It is provided as a promise!' ) ;
145145 } ) ;
146146
147- it ( 'should throw when instantiating a sync binding with an dependency' , function ( ) {
147+ it ( 'should throw when instantiating a sync binding with an async dependency' , function ( ) {
148148 var injector = new Injector ( [
149149 bind ( UserList ) . toAsyncFactory ( fetchUsers ) ,
150150 UserController
@@ -154,6 +154,19 @@ export function main() {
154154 . toThrowError ( 'Cannot instantiate UserList synchronously. It is provided as a promise! (UserController -> UserList)' ) ;
155155 } ) ;
156156
157+ it ( 'should not throw when instantiating a sync binding with a resolved async dependency' ,
158+ inject ( [ AsyncTestCompleter ] , ( async ) => {
159+ var injector = new Injector ( [
160+ bind ( UserList ) . toAsyncFactory ( fetchUsers ) ,
161+ UserController
162+ ] ) ;
163+
164+ injector . asyncGet ( UserList ) . then ( ( ) => {
165+ expect ( ( ) => { injector . get ( UserController ) ; } ) . not . toThrow ( ) ;
166+ async . done ( ) ;
167+ } ) ;
168+ } ) ) ;
169+
157170 it ( 'should resolve synchronously when an async dependency requested as a promise' , function ( ) {
158171 var injector = new Injector ( [
159172 bind ( UserList ) . toAsyncFactory ( fetchUsers ) ,
You can’t perform that action at this time.
0 commit comments