aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Integration/API/FIRQueryTests.m
diff options
context:
space:
mode:
authorGravatar Michael Lehenbauer <mikelehen@gmail.com>2017-12-18 14:21:11 -0800
committerGravatar GitHub <noreply@github.com>2017-12-18 14:21:11 -0800
commit8db0eb618d355c546e8f0894dc1e0799297c5659 (patch)
treee32cf46f60b463c5ab8a6c55b3f3c7a10c71cf7e /Firestore/Example/Tests/Integration/API/FIRQueryTests.m
parent27472b5c26763987446114145e22e08a652b6296 (diff)
Test cleanup: Adds a helper for waiting for FSTVoidErrorBlock callbacks.
* Add helper for waiting for FSTVoidErrorBlock callbacks. * Remove errorEventHandler from FSTEventAccumulator.h too. * Add synchronous enableNetwork / disableNetwork helpers. * Workaround for batch writes test flakiness.
Diffstat (limited to 'Firestore/Example/Tests/Integration/API/FIRQueryTests.m')
-rw-r--r--Firestore/Example/Tests/Integration/API/FIRQueryTests.m13
1 files changed, 2 insertions, 11 deletions
diff --git a/Firestore/Example/Tests/Integration/API/FIRQueryTests.m b/Firestore/Example/Tests/Integration/API/FIRQueryTests.m
index 14351a8..e92bbcf 100644
--- a/Firestore/Example/Tests/Integration/API/FIRQueryTests.m
+++ b/Firestore/Example/Tests/Integration/API/FIRQueryTests.m
@@ -227,12 +227,8 @@
FIRQuerySnapshot *querySnap = [self.eventAccumulator awaitEventWithName:@"initial event"];
XCTAssertEqualObjects(FIRQuerySnapshotGetData(querySnap), @[ @{ @"foo" : @1 } ]);
XCTAssertEqual(querySnap.metadata.isFromCache, NO);
- XCTestExpectation *networkDisabled = [self expectationWithDescription:@"disable network"];
- [collection.firestore.client disableNetworkWithCompletion:^(NSError *error) {
- [networkDisabled fulfill];
- }];
- [self awaitExpectations];
+ [self disableNetwork];
querySnap = [self.eventAccumulator awaitEventWithName:@"offline event with isFromCache=YES"];
XCTAssertEqual(querySnap.metadata.isFromCache, YES);
@@ -241,12 +237,7 @@
// sufficient.
[NSThread sleepForTimeInterval:0.2f];
- XCTestExpectation *networkEnabled = [self expectationWithDescription:@"enable network"];
- [collection.firestore.client enableNetworkWithCompletion:^(NSError *error) {
- [networkEnabled fulfill];
- }];
- [self awaitExpectations];
-
+ [self enableNetwork];
querySnap = [self.eventAccumulator awaitEventWithName:@"back online event with isFromCache=NO"];
XCTAssertEqual(querySnap.metadata.isFromCache, NO);
}