|
|
@@ -71,7 +71,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)testComponentsPopulatedOnInit {
|
|
|
- FIRComponentContainer *container = [self containerWithRegistrants:@ [[FIRTestClass class]]];
|
|
|
+ FIRComponentContainer *container = [self containerWithRegistrants:@[ [FIRTestClass class] ]];
|
|
|
|
|
|
// Verify that the block is stored.
|
|
|
NSString *protocolName = NSStringFromProtocol(@protocol(FIRTestProtocol));
|
|
|
@@ -82,7 +82,8 @@
|
|
|
#pragma mark - Caching Tests
|
|
|
|
|
|
- (void)testInstanceCached {
|
|
|
- FIRComponentContainer *container = [self containerWithRegistrants:@ [[FIRTestClassCached class]]];
|
|
|
+ FIRComponentContainer *container =
|
|
|
+ [self containerWithRegistrants:@[ [FIRTestClassCached class] ]];
|
|
|
|
|
|
// Fetch an instance for `FIRTestProtocolCached`, then fetch it again to assert it's cached.
|
|
|
id<FIRTestProtocolCached> instance1 = FIR_COMPONENT(FIRTestProtocolCached, container);
|
|
|
@@ -93,7 +94,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)testInstanceNotCached {
|
|
|
- FIRComponentContainer *container = [self containerWithRegistrants:@ [[FIRTestClass class]]];
|
|
|
+ FIRComponentContainer *container = [self containerWithRegistrants:@[ [FIRTestClass class] ]];
|
|
|
|
|
|
// Retrieve an instance from the container, then fetch it again and ensure it's not the same
|
|
|
// instance.
|
|
|
@@ -105,10 +106,10 @@
|
|
|
}
|
|
|
|
|
|
- (void)testRemoveAllCachedInstances {
|
|
|
- FIRComponentContainer *container =
|
|
|
- [self containerWithRegistrants:@ [[FIRTestClass class], [FIRTestClassCached class],
|
|
|
- [FIRTestClassEagerCached class],
|
|
|
- [FIRTestClassCachedWithDep class]]];
|
|
|
+ FIRComponentContainer *container = [self containerWithRegistrants:@[
|
|
|
+ [FIRTestClass class], [FIRTestClassCached class], [FIRTestClassEagerCached class],
|
|
|
+ [FIRTestClassCachedWithDep class]
|
|
|
+ ]];
|
|
|
|
|
|
// Retrieve an instance of FIRTestClassCached to ensure it's cached.
|
|
|
id<FIRTestProtocolCached> cachedInstance1 = FIR_COMPONENT(FIRTestProtocolCached, container);
|
|
|
@@ -131,10 +132,10 @@
|
|
|
}
|
|
|
|
|
|
- (void)testRemoveAllComponents {
|
|
|
- FIRComponentContainer *container =
|
|
|
- [self containerWithRegistrants:@ [[FIRTestClass class], [FIRTestClassCached class],
|
|
|
- [FIRTestClassEagerCached class],
|
|
|
- [FIRTestClassCachedWithDep class]]];
|
|
|
+ FIRComponentContainer *container = [self containerWithRegistrants:@[
|
|
|
+ [FIRTestClass class], [FIRTestClassCached class], [FIRTestClassEagerCached class],
|
|
|
+ [FIRTestClassCachedWithDep class]
|
|
|
+ ]];
|
|
|
|
|
|
// Retrieve an instance of FIRTestClassCached to ensure it's cached.
|
|
|
id<FIRTestProtocolCached> cachedInstance1 = FIR_COMPONENT(FIRTestProtocolCached, container);
|
|
|
@@ -167,7 +168,7 @@
|
|
|
// implementation for `FIRTestProtocolEagerCached` and requires eager instantiation as well as
|
|
|
// caching so the test can verify it was eagerly instantiated.
|
|
|
FIRComponentContainer *container =
|
|
|
- [self containerWithRegistrants:@ [[FIRTestClassEagerCached class]]];
|
|
|
+ [self containerWithRegistrants:@[ [FIRTestClassEagerCached class] ]];
|
|
|
NSString *protocolName = NSStringFromProtocol(@protocol(FIRTestProtocolEagerCached));
|
|
|
XCTAssertNotNil(container.cachedInstances[protocolName]);
|
|
|
}
|
|
|
@@ -181,7 +182,7 @@
|
|
|
// change in the future.
|
|
|
// TODO(wilsonryan): Assert that the log gets called warning that it's already been registered.
|
|
|
FIRComponentContainer *container =
|
|
|
- [self containerWithRegistrants:@ [[FIRTestClass class], [FIRTestClassDuplicate class]]];
|
|
|
+ [self containerWithRegistrants:@[ [FIRTestClass class], [FIRTestClassDuplicate class] ]];
|
|
|
XCTAssert(container.components.count == 1);
|
|
|
}
|
|
|
|
|
|
@@ -190,7 +191,7 @@
|
|
|
- (void)testDependencyDoesntBlock {
|
|
|
/// Test a class that has a dependency, and fetching doesn't block the internal queue.
|
|
|
FIRComponentContainer *container = [self
|
|
|
- containerWithRegistrants:@ [[FIRTestClassCached class], [FIRTestClassCachedWithDep class]]];
|
|
|
+ containerWithRegistrants:@[ [FIRTestClassCached class], [FIRTestClassCachedWithDep class] ]];
|
|
|
XCTAssert(container.components.count == 2);
|
|
|
|
|
|
id<FIRTestProtocolCachedWithDep> instanceWithDep =
|
|
|
@@ -201,7 +202,7 @@
|
|
|
- (void)testDependencyRemoveAllCachedInstancesDoesntBlock {
|
|
|
/// Test a class that has a dependency, and fetching doesn't block the internal queue.
|
|
|
FIRComponentContainer *container = [self
|
|
|
- containerWithRegistrants:@ [[FIRTestClassCached class], [FIRTestClassCachedWithDep class]]];
|
|
|
+ containerWithRegistrants:@[ [FIRTestClassCached class], [FIRTestClassCachedWithDep class] ]];
|
|
|
XCTAssert(container.components.count == 2);
|
|
|
|
|
|
id<FIRTestProtocolCachedWithDep> instanceWithDep =
|