@@ -467,48 +467,63 @@ - (void)testEnumeratingConfigResults {
467467 }];
468468}
469469
470- - (void )testFetch3pNamespaceUpdatesExperiments {
470+ - (void )testFetchAndActivate3pNamespaceUpdatesExperiments {
471471 [[_experimentMock expect ] updateExperimentsWithResponse: [OCMArg any ]];
472472
473473 XCTestExpectation *expectation = [self
474- expectationWithDescription:
475- [NSString
476- stringWithFormat: @" Fetch call for 'firebase' namespace updates experiment data" ]];
474+ expectationWithDescription: [NSString stringWithFormat: @" FetchAndActivate call for 'firebase' "
475+ @" namespace updates experiment data" ]];
477476 XCTAssertEqual (_configInstances[RCNTestRCInstanceDefault].lastFetchStatus ,
478477 FIRRemoteConfigFetchStatusNoFetchYet);
479- FIRRemoteConfigFetchCompletion fetchCompletion =
480- ^void (FIRRemoteConfigFetchStatus status, NSError *error) {
478+
479+ FIRRemoteConfigFetchAndActivateCompletion fetchAndActivateCompletion =
480+ ^void (FIRRemoteConfigFetchAndActivateStatus status, NSError *error) {
481+ XCTAssertEqual (status, FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote);
482+ XCTAssertNil (error);
483+
481484 XCTAssertEqual (self->_configInstances [RCNTestRCInstanceDefault].lastFetchStatus ,
482485 FIRRemoteConfigFetchStatusSuccess);
483- XCTAssertNil (error);
486+ XCTAssertNotNil (self->_configInstances [RCNTestRCInstanceDefault].lastFetchTime );
487+ XCTAssertGreaterThan (
488+ self->_configInstances [RCNTestRCInstanceDefault].lastFetchTime .timeIntervalSince1970 , 0 ,
489+ @" last fetch time interval should be set." );
484490 [expectation fulfill ];
485491 };
486- [_configInstances[RCNTestRCInstanceDefault] fetchWithExpirationDuration: 43200
487- completionHandler: fetchCompletion];
492+
493+ [_configInstances[RCNTestRCInstanceDefault]
494+ fetchAndActivateWithCompletionHandler: fetchAndActivateCompletion];
488495 [self waitForExpectationsWithTimeout: _expectationTimeout
489496 handler: ^(NSError *error) {
490497 XCTAssertNil (error);
491498 }];
492499}
493500
494- - (void )testFetchOtherNamespaceDoesntUpdateExperiments {
501+ - (void )testFetchAndActivateOtherNamespaceDoesntUpdateExperiments {
495502 [[_experimentMock reject ] updateExperimentsWithResponse: [OCMArg any ]];
496503
497- XCTestExpectation *expectation =
498- [ self expectationWithDescription:
499- [NSString stringWithFormat: @" Fetch call for namespace other than 'firebase' "
500- @" doesn't update experiment data" ]];
504+ XCTestExpectation *expectation = [ self
505+ expectationWithDescription:
506+ [NSString stringWithFormat: @" FetchAndActivate call for namespace other than 'firebase' "
507+ @" doesn't update experiment data" ]];
501508 XCTAssertEqual (_configInstances[RCNTestRCInstanceSecondNamespace].lastFetchStatus ,
502509 FIRRemoteConfigFetchStatusNoFetchYet);
503- FIRRemoteConfigFetchCompletion fetchCompletion =
504- ^void (FIRRemoteConfigFetchStatus status, NSError *error) {
510+
511+ FIRRemoteConfigFetchAndActivateCompletion fetchAndActivateCompletion =
512+ ^void (FIRRemoteConfigFetchAndActivateStatus status, NSError *error) {
513+ XCTAssertEqual (status, FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote);
514+ XCTAssertNil (error);
515+
505516 XCTAssertEqual (self->_configInstances [RCNTestRCInstanceSecondNamespace].lastFetchStatus ,
506517 FIRRemoteConfigFetchStatusSuccess);
507- XCTAssertNil (error);
518+ XCTAssertNotNil (self->_configInstances [RCNTestRCInstanceSecondNamespace].lastFetchTime );
519+ XCTAssertGreaterThan (self->_configInstances [RCNTestRCInstanceSecondNamespace]
520+ .lastFetchTime .timeIntervalSince1970 ,
521+ 0 , @" last fetch time interval should be set." );
508522 [expectation fulfill ];
509523 };
510- [_configInstances[RCNTestRCInstanceSecondNamespace] fetchWithExpirationDuration: 43200
511- completionHandler: fetchCompletion];
524+
525+ [_configInstances[RCNTestRCInstanceSecondNamespace]
526+ fetchAndActivateWithCompletionHandler: fetchAndActivateCompletion];
512527 [self waitForExpectationsWithTimeout: _expectationTimeout
513528 handler: ^(NSError *error) {
514529 XCTAssertNil (error);
0 commit comments