Skip to content

Commit c777cd9

Browse files
committed
Update tests to use the new commitWriteBatch method
1 parent fdecbb0 commit c777cd9

File tree

4 files changed

+6
-31
lines changed

4 files changed

+6
-31
lines changed

Firestore/Example/Tests/Integration/API/FIRAggregateTests.mm

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,13 +639,7 @@ - (void)testCanRunAggregateCollectionGroupQuery {
639639
NSString* path = [NSString stringWithFormat:format, collectionGroup];
640640
[batch setData:@{@"x" : @2} forDocument:[self.db documentWithPath:path]];
641641
}
642-
643-
XCTestExpectation* expectation = [self expectationWithDescription:@"commit"];
644-
[batch commitWithCompletion:^(NSError* error) {
645-
XCTAssertNil(error);
646-
[expectation fulfill];
647-
}];
648-
[self awaitExpectation:expectation];
642+
[self commitWriteBatch:batch];
649643

650644
FIRAggregateQuerySnapshot* snapshot =
651645
[self readSnapshotForAggregate:[[self.db collectionGroupWithID:collectionGroup] aggregate:@[

Firestore/Example/Tests/Integration/API/FIRCountTests.mm

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,7 @@ - (void)testCanRunCollectionGroupCountQuery {
163163
[batch setData:@{@"x" : @"a"} forDocument:[self.db documentWithPath:path]];
164164
}
165165

166-
XCTestExpectation* expectation = [self expectationWithDescription:@"commit"];
167-
[batch commitWithCompletion:^(NSError* error) {
168-
XCTAssertNil(error);
169-
[expectation fulfill];
170-
}];
171-
[self awaitExpectation:expectation];
166+
[self commitWriteBatch:batch];
172167

173168
FIRAggregateQuerySnapshot* snapshot =
174169
[self readSnapshotForAggregate:[[self.db collectionGroupWithID:collectionGroup] count]];

Firestore/Example/Tests/Integration/API/FIRQueryTests.mm

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -790,12 +790,7 @@ - (void)testCollectionGroupQueries {
790790
withString:collectionGroup];
791791
[batch setData:@{@"x" : @1} forDocument:[self.db documentWithPath:path]];
792792
}
793-
XCTestExpectation *expectation = [self expectationWithDescription:@"batch written"];
794-
[batch commitWithCompletion:^(NSError *error) {
795-
XCTAssertNil(error);
796-
[expectation fulfill];
797-
}];
798-
[self awaitExpectations];
793+
[self commitWriteBatch:batch];
799794

800795
FIRQuerySnapshot *querySnapshot =
801796
[self readDocumentSetForRef:[self.db collectionGroupWithID:collectionGroup]];
@@ -821,12 +816,7 @@ - (void)testCollectionGroupQueriesWithStartAtEndAtWithArbitraryDocumentIDs {
821816
withString:collectionGroup];
822817
[batch setData:@{@"x" : @1} forDocument:[self.db documentWithPath:path]];
823818
}
824-
XCTestExpectation *expectation = [self expectationWithDescription:@"batch written"];
825-
[batch commitWithCompletion:^(NSError *error) {
826-
XCTAssertNil(error);
827-
[expectation fulfill];
828-
}];
829-
[self awaitExpectations];
819+
[self commitWriteBatch:batch];
830820

831821
FIRQuerySnapshot *querySnapshot = [self
832822
readDocumentSetForRef:[[[[self.db collectionGroupWithID:collectionGroup]
@@ -858,12 +848,7 @@ - (void)testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIDs {
858848
withString:collectionGroup];
859849
[batch setData:@{@"x" : @1} forDocument:[self.db documentWithPath:path]];
860850
}
861-
XCTestExpectation *expectation = [self expectationWithDescription:@"batch written"];
862-
[batch commitWithCompletion:^(NSError *error) {
863-
XCTAssertNil(error);
864-
[expectation fulfill];
865-
}];
866-
[self awaitExpectations];
851+
[self commitWriteBatch:batch];
867852

868853
FIRQuerySnapshot *querySnapshot = [self
869854
readDocumentSetForRef:[[[self.db collectionGroupWithID:collectionGroup]

Firestore/Example/Tests/Util/FSTIntegrationTestCase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
@class FIRFirestore;
3434
@class FIRFirestoreSettings;
3535
@class FIRQuery;
36+
@class FIRWriteBatch;
3637
@class FSTEventAccumulator;
3738

3839
NS_ASSUME_NONNULL_BEGIN

0 commit comments

Comments
 (0)