@@ -88,6 +88,8 @@ class NoAnnotations {
88
88
constructor ( secretDependency ) { }
89
89
}
90
90
91
+ function factoryFn ( a ) { }
92
+
91
93
export function main ( ) {
92
94
var dynamicProviders = [
93
95
provide ( 'provider0' , { useValue : 1 } ) ,
@@ -142,10 +144,20 @@ export function main() {
142
144
expect ( car . engine ) . toBeAnInstanceOf ( TurboEngine ) ;
143
145
} ) ;
144
146
145
- it ( 'should throw when no type and not @Inject' , ( ) => {
147
+ it ( 'should throw when no type and not @Inject (class case) ' , ( ) => {
146
148
expect ( ( ) => createInjector ( [ NoAnnotations ] ) )
147
- . toThrowError ( 'Cannot resolve all parameters for NoAnnotations(?). ' +
148
- 'Make sure they all have valid type or annotations.' ) ;
149
+ . toThrowError (
150
+ "Cannot resolve all parameters for 'NoAnnotations'(?). " +
151
+ 'Make sure that all the parameters are decorated with Inject or have valid type annotations ' +
152
+ "and that 'NoAnnotations' is decorated with Injectable." ) ;
153
+ } ) ;
154
+
155
+ it ( 'should throw when no type and not @Inject (factory case)' , ( ) => {
156
+ expect ( ( ) => createInjector ( [ provide ( "someToken" , { useFactory : factoryFn } ) ] ) )
157
+ . toThrowError (
158
+ "Cannot resolve all parameters for 'factoryFn'(?). " +
159
+ 'Make sure that all the parameters are decorated with Inject or have valid type annotations ' +
160
+ "and that 'factoryFn' is decorated with Injectable." ) ;
149
161
} ) ;
150
162
151
163
it ( 'should cache instances' , ( ) => {
0 commit comments