Skip to content

Commit

Permalink
fix unit tests (#12553)
Browse files Browse the repository at this point in the history
  • Loading branch information
themiswang authored Mar 14, 2024
1 parent 7834c05 commit ca73735
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1801,16 +1801,10 @@ - (void)testRealtimeStreamRequestBody {
}

- (void)testFetchAndActivateRolloutsNotifyInterop {
id mockNotificationCenter = [OCMockObject mockForClass:[NSNotificationCenter class]];
[[mockNotificationCenter expect] postNotificationName:@"RolloutsStateDidChangeNotification"
object:[OCMArg any]
userInfo:[OCMArg any]];
id mockSubscriber = [OCMockObject mockForProtocol:@protocol(FIRRolloutsStateSubscriber)];
[[mockSubscriber expect] rolloutsStateDidChange:[OCMArg any]];

XCTestExpectation *expectation = [self
expectationWithDescription:[NSString
stringWithFormat:@"Test rollout update send notification"]];
XCTestExpectation *notificationExpectation =
[self expectationForNotification:@"FIRRolloutsStateDidChangeNotification"
object:nil
handler:nil];

XCTAssertEqual(_configInstances[RCNTestRCInstanceDefault].lastFetchStatus,
FIRRemoteConfigFetchStatusNoFetchYet);
Expand All @@ -1826,15 +1820,12 @@ - (void)testFetchAndActivateRolloutsNotifyInterop {
XCTAssertGreaterThan(
self->_configInstances[RCNTestRCInstanceDefault].lastFetchTime.timeIntervalSince1970, 0,
@"last fetch time interval should be set.");
[expectation fulfill];
[notificationExpectation fulfill];
};

[_configInstances[RCNTestRCInstanceDefault]
fetchAndActivateWithCompletionHandler:fetchAndActivateCompletion];
[self waitForExpectationsWithTimeout:_expectationTimeout
handler:^(NSError *error) {
XCTAssertNil(error);
}];
[self waitForExpectations:@[ notificationExpectation ] timeout:_expectationTimeout];
}

#pragma mark - Test Helpers
Expand Down

0 comments on commit ca73735

Please sign in to comment.