diff options
author | rsgowman <rgowman@google.com> | 2018-01-11 11:50:49 -0500 |
---|---|---|
committer | Gil <mcg@google.com> | 2018-01-11 08:50:49 -0800 |
commit | 1bafdb4ce55db1c743c36f70de810899c55e0992 (patch) | |
tree | 0182fd9af344e573f4d6a923df71c2d5f4a8db51 /Firestore/Example/Tests/Integration | |
parent | 4cdd87af03495f529b2a4c857ea2e4d74b81a862 (diff) |
Fix FSTLocalDocumentsView to allow multiple mutations while offline (#644)
* Fix FSTLocalDocumentsView to allow multiple mutations while offline.
Previously, only the last mutation would actually be visible.
Diffstat (limited to 'Firestore/Example/Tests/Integration')
-rw-r--r-- | Firestore/Example/Tests/Integration/API/FIRQueryTests.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Firestore/Example/Tests/Integration/API/FIRQueryTests.m b/Firestore/Example/Tests/Integration/API/FIRQueryTests.m index 831c897..58f57bc 100644 --- a/Firestore/Example/Tests/Integration/API/FIRQueryTests.m +++ b/Firestore/Example/Tests/Integration/API/FIRQueryTests.m @@ -275,4 +275,27 @@ [registration remove]; } +- (void)testCanHaveMultipleMutationsWhileOffline { + FIRCollectionReference *col = [self collectionRef]; + + // set a few docs to known values + NSDictionary *initialDocs = + @{ @"doc1" : @{@"key1" : @"value1"}, + @"doc2" : @{@"key2" : @"value2"} }; + [self writeAllDocuments:initialDocs toCollection:col]; + + // go offline for the rest of this test + [self disableNetwork]; + + // apply *multiple* mutations while offline + [[col documentWithPath:@"doc1"] setData:@{@"key1b" : @"value1b"}]; + [[col documentWithPath:@"doc2"] setData:@{@"key2b" : @"value2b"}]; + + FIRQuerySnapshot *result = [self readDocumentSetForRef:col]; + XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ + @{@"key1b" : @"value1b"}, + @{@"key2b" : @"value2b"}, + ])); +} + @end |