Skip to content

Commit ca73735

Browse files
authored
fix unit tests (#12553)
1 parent 7834c05 commit ca73735

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m

+6-15
Original file line numberDiff line numberDiff line change
@@ -1801,16 +1801,10 @@ - (void)testRealtimeStreamRequestBody {
18011801
}
18021802

18031803
- (void)testFetchAndActivateRolloutsNotifyInterop {
1804-
id mockNotificationCenter = [OCMockObject mockForClass:[NSNotificationCenter class]];
1805-
[[mockNotificationCenter expect] postNotificationName:@"RolloutsStateDidChangeNotification"
1806-
object:[OCMArg any]
1807-
userInfo:[OCMArg any]];
1808-
id mockSubscriber = [OCMockObject mockForProtocol:@protocol(FIRRolloutsStateSubscriber)];
1809-
[[mockSubscriber expect] rolloutsStateDidChange:[OCMArg any]];
1810-
1811-
XCTestExpectation *expectation = [self
1812-
expectationWithDescription:[NSString
1813-
stringWithFormat:@"Test rollout update send notification"]];
1804+
XCTestExpectation *notificationExpectation =
1805+
[self expectationForNotification:@"FIRRolloutsStateDidChangeNotification"
1806+
object:nil
1807+
handler:nil];
18141808

18151809
XCTAssertEqual(_configInstances[RCNTestRCInstanceDefault].lastFetchStatus,
18161810
FIRRemoteConfigFetchStatusNoFetchYet);
@@ -1826,15 +1820,12 @@ - (void)testFetchAndActivateRolloutsNotifyInterop {
18261820
XCTAssertGreaterThan(
18271821
self->_configInstances[RCNTestRCInstanceDefault].lastFetchTime.timeIntervalSince1970, 0,
18281822
@"last fetch time interval should be set.");
1829-
[expectation fulfill];
1823+
[notificationExpectation fulfill];
18301824
};
18311825

18321826
[_configInstances[RCNTestRCInstanceDefault]
18331827
fetchAndActivateWithCompletionHandler:fetchAndActivateCompletion];
1834-
[self waitForExpectationsWithTimeout:_expectationTimeout
1835-
handler:^(NSError *error) {
1836-
XCTAssertNil(error);
1837-
}];
1828+
[self waitForExpectations:@[ notificationExpectation ] timeout:_expectationTimeout];
18381829
}
18391830

18401831
#pragma mark - Test Helpers

0 commit comments

Comments
 (0)