Skip to content

Commit fd00f7b

Browse files
Fix unit tests
1 parent 48dcf7e commit fd00f7b

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/DocumentSnapshotTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ public void testEquals() {
4545
assertNotEquals(base, differentData);
4646
assertNotEquals(base, fromCache);
4747

48+
// Note: base and differentData have the same hash code since we no longer take document
49+
// contents into account.
4850
assertEquals(base.hashCode(), baseDup.hashCode());
4951
assertEquals(noData.hashCode(), noDataDup.hashCode());
5052
assertNotEquals(base.hashCode(), noData.hashCode());
5153
assertNotEquals(noData.hashCode(), base.hashCode());
5254
assertNotEquals(base.hashCode(), differentPath.hashCode());
53-
assertNotEquals(base.hashCode(), differentData.hashCode());
5455
assertNotEquals(base.hashCode(), fromCache.hashCode());
5556
}
5657
}

firebase-firestore/src/test/java/com/google/firebase/firestore/QuerySnapshotTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ public void testEquals() {
7171
assertNotEquals(foo, noPendingWrites);
7272
assertNotEquals(foo, fromCache);
7373

74+
// Note: foo and differentDoc have the same hash code since we no longer take document contents
75+
// into account.
7476
assertEquals(foo.hashCode(), fooDup.hashCode());
7577
assertNotEquals(foo.hashCode(), differentPath.hashCode());
76-
assertNotEquals(foo.hashCode(), differentDoc.hashCode());
7778
assertNotEquals(foo.hashCode(), noPendingWrites.hashCode());
7879
assertNotEquals(foo.hashCode(), fromCache.hashCode());
7980
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ public void testHandlesSetMutation() {
229229
assertChanged(doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.LOCAL_MUTATIONS));
230230
assertContains(doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.LOCAL_MUTATIONS));
231231

232-
acknowledgeMutation(0);
233-
assertChanged(doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.COMMITTED_MUTATIONS));
232+
acknowledgeMutation(1);
233+
assertChanged(doc("foo/bar", 1, map("foo", "bar"), Document.DocumentState.COMMITTED_MUTATIONS));
234234
if (garbageCollectorIsEager()) {
235235
// Nothing is pinning this anymore, as it has been acknowledged and there are no targets
236236
// active.
237237
assertNotContains("foo/bar");
238238
} else {
239239
assertContains(
240-
doc("foo/bar", 0, map("foo", "bar"), Document.DocumentState.COMMITTED_MUTATIONS));
240+
doc("foo/bar", 1, map("foo", "bar"), Document.DocumentState.COMMITTED_MUTATIONS));
241241
}
242242
}
243243

firebase-firestore/src/test/resources/json/listen_spec_test.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@
582582
"docs": [
583583
{
584584
"key": "collection/a",
585-
"version": 0,
585+
"version": 1000,
586586
"value": {
587587
"key": "a"
588588
},
@@ -620,7 +620,7 @@
620620
"added": [
621621
{
622622
"key": "collection/a",
623-
"version": 0,
623+
"version": 1000,
624624
"value": {
625625
"key": "a"
626626
},
@@ -648,7 +648,7 @@
648648
"removed": [
649649
{
650650
"key": "collection/a",
651-
"version": 0,
651+
"version": 1000,
652652
"value": {
653653
"key": "a"
654654
},

firebase-firestore/src/test/resources/json/orderby_spec_test.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
"docs": [
220220
{
221221
"key": "collection/a",
222-
"version": 0,
222+
"version": 1000,
223223
"value": {
224224
"key": "a",
225225
"sort": 2
@@ -287,7 +287,7 @@
287287
},
288288
{
289289
"key": "collection/a",
290-
"version": 0,
290+
"version": 1000,
291291
"value": {
292292
"key": "a",
293293
"sort": 2
@@ -387,7 +387,7 @@
387387
},
388388
{
389389
"key": "collection/a",
390-
"version": 0,
390+
"version": 1000,
391391
"value": {
392392
"key": "a",
393393
"sort": 2

0 commit comments

Comments
 (0)