Skip to content

Commit cefbaa2

Browse files
Fix unit tests
1 parent 6889dc5 commit cefbaa2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public void testHandlesSetMutationThenAckThenRelease() {
284284
allocateQuery(query);
285285

286286
writeMutation(setMutation("foo/bar", map("foo", "bar")));
287-
notifyLocalViewChanges(viewChanges(2, asList("foo/bar"), emptyList()));
287+
notifyLocalViewChanges(viewChanges(2, /* synced= */ false, asList("foo/bar"), emptyList()));
288288

289289
assertChanged(doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.LOCAL_MUTATIONS));
290290
assertContains(doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.LOCAL_MUTATIONS));
@@ -804,14 +804,16 @@ public void testPinsDocumentsInTheLocalView() {
804804
assertContains(doc("foo/bar", 1, map("foo", "bar")));
805805
assertContains(doc("foo/baz", 0, map("foo", "baz"), Document.DocumentState.LOCAL_MUTATIONS));
806806

807-
notifyLocalViewChanges(viewChanges(2, asList("foo/bar", "foo/baz"), emptyList()));
807+
notifyLocalViewChanges(
808+
viewChanges(2, /* synced= */ false, asList("foo/bar", "foo/baz"), emptyList()));
808809
applyRemoteEvent(updateRemoteEvent(doc("foo/bar", 1, map("foo", "bar")), none, two));
809810
applyRemoteEvent(updateRemoteEvent(doc("foo/baz", 2, map("foo", "baz")), two, none));
810811
acknowledgeMutation(2);
811812
assertContains(doc("foo/bar", 1, map("foo", "bar")));
812813
assertContains(doc("foo/baz", 2, map("foo", "baz")));
813814

814-
notifyLocalViewChanges(viewChanges(2, emptyList(), asList("foo/bar", "foo/baz")));
815+
notifyLocalViewChanges(
816+
viewChanges(2, /* synced= */ true, emptyList(), asList("foo/bar", "foo/baz")));
815817
releaseQuery(query);
816818

817819
assertNotContains("foo/bar");

firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/TestUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public static MutationResult mutationResult(long version) {
509509
}
510510

511511
public static LocalViewChanges viewChanges(
512-
int targetId, List<String> addedKeys, List<String> removedKeys) {
512+
int targetId, boolean synced, List<String> addedKeys, List<String> removedKeys) {
513513
ImmutableSortedSet<DocumentKey> added = DocumentKey.emptyKeySet();
514514
for (String keyPath : addedKeys) {
515515
added = added.insert(key(keyPath));
@@ -518,7 +518,7 @@ public static LocalViewChanges viewChanges(
518518
for (String keyPath : removedKeys) {
519519
removed = removed.insert(key(keyPath));
520520
}
521-
return new LocalViewChanges(targetId, added, removed);
521+
return new LocalViewChanges(targetId, synced, added, removed);
522522
}
523523

524524
/** Creates a resume token to match the given snapshot version. */

0 commit comments

Comments
 (0)