@@ -467,48 +467,63 @@ - (void)testEnumeratingConfigResults {
467
467
}];
468
468
}
469
469
470
- - (void )testFetch3pNamespaceUpdatesExperiments {
470
+ - (void )testFetchAndActivate3pNamespaceUpdatesExperiments {
471
471
[[_experimentMock expect ] updateExperimentsWithResponse: [OCMArg any ]];
472
472
473
473
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" ]];
477
476
XCTAssertEqual (_configInstances[RCNTestRCInstanceDefault].lastFetchStatus ,
478
477
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
+
481
484
XCTAssertEqual (self->_configInstances [RCNTestRCInstanceDefault].lastFetchStatus ,
482
485
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." );
484
490
[expectation fulfill ];
485
491
};
486
- [_configInstances[RCNTestRCInstanceDefault] fetchWithExpirationDuration: 43200
487
- completionHandler: fetchCompletion];
492
+
493
+ [_configInstances[RCNTestRCInstanceDefault]
494
+ fetchAndActivateWithCompletionHandler: fetchAndActivateCompletion];
488
495
[self waitForExpectationsWithTimeout: _expectationTimeout
489
496
handler: ^(NSError *error) {
490
497
XCTAssertNil (error);
491
498
}];
492
499
}
493
500
494
- - (void )testFetchOtherNamespaceDoesntUpdateExperiments {
501
+ - (void )testFetchAndActivateOtherNamespaceDoesntUpdateExperiments {
495
502
[[_experimentMock reject ] updateExperimentsWithResponse: [OCMArg any ]];
496
503
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" ]];
501
508
XCTAssertEqual (_configInstances[RCNTestRCInstanceSecondNamespace].lastFetchStatus ,
502
509
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
+
505
516
XCTAssertEqual (self->_configInstances [RCNTestRCInstanceSecondNamespace].lastFetchStatus ,
506
517
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." );
508
522
[expectation fulfill ];
509
523
};
510
- [_configInstances[RCNTestRCInstanceSecondNamespace] fetchWithExpirationDuration: 43200
511
- completionHandler: fetchCompletion];
524
+
525
+ [_configInstances[RCNTestRCInstanceSecondNamespace]
526
+ fetchAndActivateWithCompletionHandler: fetchAndActivateCompletion];
512
527
[self waitForExpectationsWithTimeout: _expectationTimeout
513
528
handler: ^(NSError *error) {
514
529
XCTAssertNil (error);
0 commit comments