diff options
Diffstat (limited to 'Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm')
-rw-r--r-- | Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm b/Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm index 36d3661..d0466f9 100644 --- a/Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm +++ b/Firestore/Example/Tests/Local/FSTRemoteDocumentChangeBufferTests.mm @@ -68,8 +68,10 @@ NS_ASSUME_NONNULL_BEGIN } - (void)testReadUnchangedEntry { + FSTWriteGroup *group = [_db startGroupWithAction:@"ReadUnchangedEntry"]; XCTAssertEqualObjects([_remoteDocumentBuffer entryForKey:FSTTestDocKey(@"coll/a")], _kInitialADoc); + [_db commitGroup:group]; } - (void)testAddEntryAndReadItBack { @@ -78,24 +80,28 @@ NS_ASSUME_NONNULL_BEGIN XCTAssertEqualObjects([_remoteDocumentBuffer entryForKey:FSTTestDocKey(@"coll/a")], newADoc); // B should still be unchanged. + FSTWriteGroup *group = [_db startGroupWithAction:@"AddEntryAndReadItBack"]; XCTAssertEqualObjects([_remoteDocumentBuffer entryForKey:FSTTestDocKey(@"coll/b")], _kInitialBDoc); + [_db commitGroup:group]; } - (void)testApplyChanges { FSTMaybeDocument *newADoc = FSTTestDoc("coll/a", 43, @{@"new" : @"data"}, NO); [_remoteDocumentBuffer addEntry:newADoc]; + FSTWriteGroup *group = [_db startGroupWithAction:@"Apply Changes"]; XCTAssertEqualObjects([_remoteDocumentBuffer entryForKey:FSTTestDocKey(@"coll/a")], newADoc); // Reading directly against the cache should still yield the old result. XCTAssertEqualObjects([_remoteDocumentCache entryForKey:FSTTestDocKey(@"coll/a")], _kInitialADoc); + [_db commitGroup:group]; - FSTWriteGroup *group = [_db startGroupWithAction:@"Apply changes"]; + group = [_db startGroupWithAction:@"Apply changes"]; [_remoteDocumentBuffer applyToWriteGroup:group]; - [_db commitGroup:group]; // Reading against the cache should now yield the new result. XCTAssertEqualObjects([_remoteDocumentCache entryForKey:FSTTestDocKey(@"coll/a")], newADoc); + [_db commitGroup:group]; } - (void)testMethodsThrowAfterApply { |