File tree 3 files changed +18
-7
lines changed
Example/Tests/Integration/API 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,14 @@ - (void)testCanUpdateAnUnknownDocument {
65
65
[self readDocumentForRef: writerRef source: FIRFirestoreSourceCache];
66
66
XCTAssertTrue (writerSnap.exists );
67
67
68
- XCTAssertThrows (^() {
69
- [self readDocumentForRef: readerRef source: FIRFirestoreSourceCache];
70
- });
68
+ XCTestExpectation *expectation =
69
+ [self expectationWithDescription: @" testCanUpdateAnUnknownDocument" ];
70
+ [readerRef getDocumentWithSource: FIRFirestoreSourceCache
71
+ completion: ^(FIRDocumentSnapshot *doc, NSError *_Nullable error) {
72
+ XCTAssertNotNil (error);
73
+ [expectation fulfill ];
74
+ }];
75
+ [self awaitExpectations ];
71
76
72
77
writerSnap = [self readDocumentForRef: writerRef];
73
78
XCTAssertEqualObjects (writerSnap.data , (@{@" a" : @" a" , @" b" : @" b" }));
Original file line number Diff line number Diff line change @@ -287,14 +287,20 @@ - (void)getDocumentFromLocalCache:(FIRDocumentReference *)doc
287
287
FSTMaybeDocument *maybeDoc = [self .localStore readDocument: doc.key];
288
288
FIRDocumentSnapshot *_Nullable result = nil ;
289
289
NSError *_Nullable error = nil ;
290
- if (maybeDoc) {
291
- FSTDocument *_Nullable document =
292
- ([maybeDoc isKindOfClass: [ FSTDocument class ]]) ? (FSTDocument *)maybeDoc : nil ;
290
+
291
+ if ([maybeDoc isKindOfClass: [ FSTDocument class ]]) {
292
+ FSTDocument *document = (FSTDocument *)maybeDoc;
293
293
result = [FIRDocumentSnapshot snapshotWithFirestore: doc.firestore
294
294
documentKey: doc.key
295
295
document: document
296
296
fromCache: YES
297
297
hasPendingWrites: document.hasLocalMutations];
298
+ } else if ([maybeDoc isKindOfClass: [FSTDeletedDocument class ]]) {
299
+ result = [FIRDocumentSnapshot snapshotWithFirestore: doc.firestore
300
+ documentKey: doc.key
301
+ document: nil
302
+ fromCache: YES
303
+ hasPendingWrites: NO ];
298
304
} else {
299
305
error = [NSError errorWithDomain: FIRFirestoreErrorDomain
300
306
code: FIRFirestoreErrorCodeUnavailable
Original file line number Diff line number Diff line change @@ -407,7 +407,7 @@ - (void)releaseQuery:(FSTQuery *)query {
407
407
queryData = cachedQueryData;
408
408
[self .queryCache updateQueryData: queryData];
409
409
}
410
-
410
+
411
411
// References for documents sent via Watch are automatically removed when we delete a
412
412
// query's target data from the reference delegate. Since this does not remove references
413
413
// for locally mutated documents, we have to remove the target associations for these
You can’t perform that action at this time.
0 commit comments