File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,20 @@ describe('Provider', () => {
197197 expect ( callback ) . to . have . been . calledOnce ;
198198 } ) ;
199199
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+
200214 it ( 'passes instance identifier' , ( ) => {
201215 provider . setComponent (
202216 getFakeComponent (
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export class Provider<T extends Name> {
272272 existingCallbacks . add ( callback ) ;
273273 this . onInitCallbacks . set ( normalizedIdentifier , existingCallbacks ) ;
274274
275- const existingInstance = this . instances . has ( normalizedIdentifier ) ;
275+ const existingInstance = this . instances . get ( normalizedIdentifier ) ;
276276 if ( existingInstance ) {
277277 callback ( existingInstance , normalizedIdentifier ) ;
278278 }
You can’t perform that action at this time.
0 commit comments