@@ -311,7 +311,7 @@ - (void)primeBackend {
311
311
}];
312
312
313
313
// Wait for watch to initialize and deliver first event.
314
- [self awaitExpectations ];
314
+ [self awaitExpectation: watchInitialized ];
315
315
316
316
watchUpdateReceived = [self expectationWithDescription: @" Prime backend: Watch update received" ];
317
317
@@ -340,17 +340,18 @@ - (void)primeBackend {
340
340
}
341
341
342
342
- (void )terminateFirestore : (FIRFirestore *)firestore {
343
- [firestore terminateWithCompletion: [self completionForExpectationWithName: @" shutdown" ]];
344
- [self awaitExpectations ];
343
+ XCTestExpectation *expectation = [self expectationWithDescription: @" shutdown" ];
344
+ [firestore terminateWithCompletion: [self completionForExpectation: expectation]];
345
+ [self awaitExpectation: expectation];
345
346
}
346
347
347
348
- (void )deleteApp : (FIRApp *)app {
348
- XCTestExpectation *expectation = [self expectationWithDescription: @" Delete app " ];
349
+ XCTestExpectation *expectation = [self expectationWithDescription: @" deleteApp " ];
349
350
[app deleteApp: ^(BOOL completion) {
350
351
XCTAssertTrue (completion);
351
352
[expectation fulfill ];
352
353
}];
353
- [self awaitExpectations ];
354
+ [self awaitExpectation: expectation ];
354
355
}
355
356
356
357
- (NSString *)documentPath {
@@ -412,7 +413,7 @@ - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref
412
413
result = doc;
413
414
[expectation fulfill ];
414
415
}];
415
- [self awaitExpectations ];
416
+ [self awaitExpectation: expectation ];
416
417
417
418
return result;
418
419
}
@@ -431,7 +432,7 @@ - (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query source:(FIRFiresto
431
432
result = documentSet;
432
433
[expectation fulfill ];
433
434
}];
434
- [self awaitExpectations ];
435
+ [self awaitExpectation: expectation ];
435
436
436
437
return result;
437
438
}
@@ -452,61 +453,63 @@ - (FIRDocumentSnapshot *)readSnapshotForRef:(FIRDocumentReference *)ref
452
453
}
453
454
}];
454
455
455
- [self awaitExpectations ];
456
+ [self awaitExpectation: expectation ];
456
457
[listener remove ];
457
458
458
459
return result;
459
460
}
460
461
461
462
- (void )writeDocumentRef : (FIRDocumentReference *)ref data : (NSDictionary <NSString *, id> *)data {
462
- [ref setData: data completion: [self completionForExpectationWithName: @" setData" ]];
463
- [self awaitExpectations ];
463
+ XCTestExpectation *expectation = [self expectationWithDescription: @" setData" ];
464
+ [ref setData: data completion: [self completionForExpectation: expectation]];
465
+ [self awaitExpectation: expectation];
464
466
}
465
467
466
468
- (void )updateDocumentRef : (FIRDocumentReference *)ref data : (NSDictionary <id, id> *)data {
467
- [ref updateData: data completion: [self completionForExpectationWithName: @" updateData" ]];
468
- [self awaitExpectations ];
469
+ XCTestExpectation *expectation = [self expectationWithDescription: @" updateData" ];
470
+ [ref updateData: data completion: [self completionForExpectation: expectation]];
471
+ [self awaitExpectation: expectation];
469
472
}
470
473
471
474
- (void )deleteDocumentRef : (FIRDocumentReference *)ref {
472
- [ref deleteDocumentWithCompletion: [self completionForExpectationWithName: @" deleteDocument" ]];
473
- [self awaitExpectations ];
475
+ XCTestExpectation *expectation = [self expectationWithDescription: @" deleteDocument" ];
476
+ [ref deleteDocumentWithCompletion: [self completionForExpectation: expectation]];
477
+ [self awaitExpectation: expectation];
474
478
}
475
479
476
480
- (FIRDocumentReference *)addDocumentRef : (FIRCollectionReference *)ref
477
481
data : (NSDictionary <NSString *, id> *)data {
478
- FIRDocumentReference *doc =
479
- [ref addDocumentWithData: data
480
- completion: [self completionForExpectationWithName: @" addDocument " ]];
481
- [self awaitExpectations ];
482
+ XCTestExpectation *expectation = [ self expectationWithDescription: @" addDocument " ];
483
+ FIRDocumentReference *doc = [ref addDocumentWithData: data
484
+ completion: [self completionForExpectation: expectation ]];
485
+ [self awaitExpectation: expectation ];
482
486
return doc;
483
487
}
484
488
485
489
- (void )mergeDocumentRef : (FIRDocumentReference *)ref data : (NSDictionary <NSString *, id> *)data {
486
- [ref setData: data
487
- merge: YES
488
- completion: [self completionForExpectationWithName: @" setDataWithMerge" ]];
489
- [self awaitExpectations ];
490
+ XCTestExpectation *expectation = [self expectationWithDescription: @" setDataWithMerge" ];
491
+ [ref setData: data merge: YES completion: [self completionForExpectation: expectation]];
492
+ [self awaitExpectation: expectation];
490
493
}
491
494
492
495
- (void )mergeDocumentRef : (FIRDocumentReference *)ref
493
496
data : (NSDictionary <NSString *, id> *)data
494
497
fields : (NSArray <id> *)fields {
495
- [ref setData: data
496
- mergeFields: fields
497
- completion: [self completionForExpectationWithName: @" setDataWithMerge" ]];
498
- [self awaitExpectations ];
498
+ XCTestExpectation *expectation = [self expectationWithDescription: @" setDataWithMerge" ];
499
+ [ref setData: data mergeFields: fields completion: [self completionForExpectation: expectation]];
500
+ [self awaitExpectation: expectation];
499
501
}
500
502
501
503
- (void )disableNetwork {
502
- [self .db
503
- disableNetworkWithCompletion: [self completionForExpectationWithName: @" Disable Network. " ]];
504
- [self awaitExpectations ];
504
+ XCTestExpectation *expectation = [self expectationWithDescription: @" disableNetwork " ];
505
+ [ self .db disableNetworkWithCompletion: [self completionForExpectation: expectation ]];
506
+ [self awaitExpectation: expectation ];
505
507
}
506
508
507
509
- (void )enableNetwork {
508
- [self .db enableNetworkWithCompletion: [self completionForExpectationWithName: @" Enable Network." ]];
509
- [self awaitExpectations ];
510
+ XCTestExpectation *expectation = [self expectationWithDescription: @" enableNetwork" ];
511
+ [self .db enableNetworkWithCompletion: [self completionForExpectation: expectation]];
512
+ [self awaitExpectation: expectation];
510
513
}
511
514
512
515
- (const std::shared_ptr<util::AsyncQueue> &)queueForFirestore : (FIRFirestore *)firestore {
0 commit comments