File tree 2 files changed +15
-1
lines changed 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,20 @@ describe('Provider', () => {
197
197
expect ( callback ) . to . have . been . calledOnce ;
198
198
} ) ;
199
199
200
+ it ( 'passes service instance' , ( ) => {
201
+ const serviceInstance = { test : true } ;
202
+ provider . setComponent ( getFakeComponent ( 'test' , ( ) => serviceInstance ) ) ;
203
+ const callback = fake ( ) ;
204
+
205
+ // initialize the service instance
206
+ provider . getImmediate ( ) ;
207
+
208
+ provider . onInit ( callback ) ;
209
+
210
+ expect ( callback ) . to . have . been . calledOnce ;
211
+ expect ( callback ) . to . have . been . calledWith ( serviceInstance ) ;
212
+ } ) ;
213
+
200
214
it ( 'passes instance identifier' , ( ) => {
201
215
provider . setComponent (
202
216
getFakeComponent (
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export class Provider<T extends Name> {
272
272
existingCallbacks . add ( callback ) ;
273
273
this . onInitCallbacks . set ( normalizedIdentifier , existingCallbacks ) ;
274
274
275
- const existingInstance = this . instances . has ( normalizedIdentifier ) ;
275
+ const existingInstance = this . instances . get ( normalizedIdentifier ) ;
276
276
if ( existingInstance ) {
277
277
callback ( existingInstance , normalizedIdentifier ) ;
278
278
}
You can’t perform that action at this time.
0 commit comments