Skip to content

Commit 207d77c

Browse files
committed
SQLiteLocalStoreTest.java: add test: testDocumentTypeIsSetToNoDocumentWhenUnknownDocumentDeleted
1 parent 54a9c86 commit 207d77c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteLocalStoreTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ public void testIndexAutoCreationDoesnotWorkWithMultipleInequality() {
829829
}
830830

831831
@Test
832-
public void testDocumentTypeIsSetWhenDocumentedAdded() {
832+
public void testDocumentTypeIsSetToFoundWhenFoundDocumentAdded() {
833833
Query query = query("coll");
834834
int targetId = allocateQuery(query);
835835
MutableDocument doc = doc("coll/a", 10, map("foo", 42));
@@ -842,7 +842,20 @@ public void testDocumentTypeIsSetWhenDocumentedAdded() {
842842
}
843843

844844
@Test
845-
public void testDocumentTypeIsUpdatedWhenDocumentedDeleted() {
845+
public void testDocumentTypeIsSetToNoDocumentWhenUnknownDocumentDeleted() {
846+
Query query = query("coll");
847+
int targetId = allocateQuery(query);
848+
MutableDocument doc = doc("coll/a", 10, map("foo", 42));
849+
850+
applyRemoteEvent(removedRemoteEvent(doc.getKey(), 10, targetId));
851+
852+
Map<ResourcePath, Integer> expected = new HashMap<>();
853+
expected.put(doc.getKey().getPath(), 1); // 1 is a "no" document
854+
assertThat(getDocumentTypeByPathFromRemoteDocumentsTable()).containsExactlyEntriesIn(expected);
855+
}
856+
857+
@Test
858+
public void testDocumentTypeIsUpdatedToNoDocumentWhenFoundDocumentDeleted() {
846859
Query query = query("coll");
847860
int targetId = allocateQuery(query);
848861
MutableDocument doc = doc("coll/a", 10, map("foo", 42));

0 commit comments

Comments
 (0)