@@ -88,6 +88,9 @@ - (void)tearDown {
8888}
8989
9090- (void )testConfigure {
91+ [self
92+ registerLibrariesWithClasses: @ [[FIRTestClassCached class ], [FIRTestClassEagerCached class ]]];
93+
9194 NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName: kFIRDefaultAppName
9295 isDefaultApp: YES ];
9396 [self expectNotificationForObserver: self .observerMock
@@ -102,6 +105,11 @@ - (void)testConfigure {
102105 XCTAssertEqualObjects (app.name , kFIRDefaultAppName );
103106 XCTAssertEqualObjects (app.options .clientID , kClientID );
104107 XCTAssertTrue ([FIRApp allApps ].count == 1 );
108+
109+ // Check the registered libraries instances available.
110+ XCTAssertNotNil (FIR_COMPONENT (FIRTestProtocolCached, app.container ));
111+ XCTAssertNotNil (FIR_COMPONENT (FIRTestProtocolEagerCached, app.container ));
112+ XCTAssertNil (FIR_COMPONENT (FIRTestProtocol, app.container ));
105113}
106114
107115- (void )testConfigureWithNoDefaultOptions {
@@ -321,13 +329,22 @@ - (void)testAppNamed {
321329}
322330
323331- (void )testDeleteApp {
332+ [self
333+ registerLibrariesWithClasses: @ [[FIRTestClassCached class ], [FIRTestClassEagerCached class ]]];
334+
324335 NSString *name = NSStringFromSelector (_cmd);
325336 FIROptions *options = [[FIROptions alloc ] initWithGoogleAppID: kGoogleAppID
326337 GCMSenderID: kGCMSenderID ];
327338 [FIRApp configureWithName: name options: options];
328339 FIRApp *app = [FIRApp appNamed: name];
329340 XCTAssertNotNil (app);
330341 XCTAssertTrue ([FIRApp allApps ].count == 1 );
342+
343+ // Check the registered libraries instances available.
344+ XCTAssertNotNil (FIR_COMPONENT (FIRTestProtocolCached, app.container ));
345+ XCTAssertNotNil (FIR_COMPONENT (FIRTestProtocolEagerCached, app.container ));
346+ XCTAssertNil (FIR_COMPONENT (FIRTestProtocol, app.container ));
347+
331348 [self expectNotificationForObserver: self .observerMock
332349 notificationName: kFIRAppDeleteNotification
333350 object: [FIRApp class ]
@@ -342,6 +359,10 @@ - (void)testDeleteApp {
342359 [self waitForExpectations: @[ expectation ] timeout: 1 ];
343360 OCMVerifyAll (self.observerMock );
344361 XCTAssertTrue ([FIRApp allApps ].count == 0 );
362+
363+ // Check no new library instances created after the app delete.
364+ XCTAssertNil (FIR_COMPONENT (FIRTestProtocolCached, app.container ));
365+ XCTAssertNil (FIR_COMPONENT (FIRTestProtocolEagerCached, app.container ));
345366}
346367
347368- (void )testErrorForSubspecConfigurationFailure {
@@ -889,4 +910,10 @@ - (FIROptions *)appOptions {
889910 return [[FIROptions alloc ] initWithGoogleAppID: kGoogleAppID GCMSenderID: kGCMSenderID ];
890911}
891912
913+ - (void )registerLibrariesWithClasses : (NSArray <Class> *)classes {
914+ for (Class klass in classes) {
915+ [FIRApp registerInternalLibrary: klass withName: NSStringFromClass (klass) withVersion: @" 1.0" ];
916+ }
917+ }
918+
892919@end
0 commit comments