@@ -88,6 +88,9 @@ - (void)tearDown {
88
88
}
89
89
90
90
- (void )testConfigure {
91
+ [self
92
+ registerLibrariesWithClasses: @ [[FIRTestClassCached class ], [FIRTestClassEagerCached class ]]];
93
+
91
94
NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName: kFIRDefaultAppName
92
95
isDefaultApp: YES ];
93
96
[self expectNotificationForObserver: self .observerMock
@@ -102,6 +105,11 @@ - (void)testConfigure {
102
105
XCTAssertEqualObjects (app.name , kFIRDefaultAppName );
103
106
XCTAssertEqualObjects (app.options .clientID , kClientID );
104
107
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 ));
105
113
}
106
114
107
115
- (void )testConfigureWithNoDefaultOptions {
@@ -321,13 +329,22 @@ - (void)testAppNamed {
321
329
}
322
330
323
331
- (void )testDeleteApp {
332
+ [self
333
+ registerLibrariesWithClasses: @ [[FIRTestClassCached class ], [FIRTestClassEagerCached class ]]];
334
+
324
335
NSString *name = NSStringFromSelector (_cmd);
325
336
FIROptions *options = [[FIROptions alloc ] initWithGoogleAppID: kGoogleAppID
326
337
GCMSenderID: kGCMSenderID ];
327
338
[FIRApp configureWithName: name options: options];
328
339
FIRApp *app = [FIRApp appNamed: name];
329
340
XCTAssertNotNil (app);
330
341
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
+
331
348
[self expectNotificationForObserver: self .observerMock
332
349
notificationName: kFIRAppDeleteNotification
333
350
object: [FIRApp class ]
@@ -342,6 +359,10 @@ - (void)testDeleteApp {
342
359
[self waitForExpectations: @[ expectation ] timeout: 1 ];
343
360
OCMVerifyAll (self.observerMock );
344
361
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 ));
345
366
}
346
367
347
368
- (void )testErrorForSubspecConfigurationFailure {
@@ -889,4 +910,10 @@ - (FIROptions *)appOptions {
889
910
return [[FIROptions alloc ] initWithGoogleAppID: kGoogleAppID GCMSenderID: kGCMSenderID ];
890
911
}
891
912
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
+
892
919
@end
0 commit comments