Skip to content

Commit a0a933e

Browse files
committed
Update limbo_spec.test.ts
1 parent c2e6aaa commit a0a933e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

packages/firestore/test/unit/specs/limbo_spec.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,48 @@ describeSpec('Limbo Documents:', [], () => {
928928
}
929929
);
930930

931+
// Reproduce the bug in b/238823695
932+
specTest(
933+
'Limbo resolution should wait for full re-query result if there is an existence filter mismatch ',
934+
[],
935+
() => {
936+
const query1 = query('collection');
937+
const docA = doc('collection/a', 1000, { v: 1 });
938+
const docB = doc('collection/b', 1000, { v: 2 });
939+
return (
940+
spec()
941+
.userListens(query1)
942+
.watchAcksFull(query1, 1000, docA, docB)
943+
.expectEvents(query1, { added: [docA, docB] })
944+
// Simulate that the client loses network connection.
945+
.disableNetwork()
946+
.expectEvents(query1, { fromCache: true })
947+
.enableNetwork()
948+
.restoreListen(query1, 'resume-token-1000')
949+
.watchAcks(query1)
950+
// DocB is deleted in the next sync.
951+
.watchFilters([query1], [docA.key])
952+
// Bugged behavior: Missing watchCurrent here will move
953+
// all the docs to limbo unnecessarily.
954+
.watchCurrents(query1, 'resume-token-2000')
955+
.watchSnapshots(2000)
956+
.expectActiveTargets({
957+
query: query1,
958+
resumeToken: '',
959+
targetPurpose: TargetPurpose.ExistenceFilterMismatch
960+
})
961+
.watchRemoves(query1)
962+
.watchAcksFull(query1, 3000, docA)
963+
// Only the deleted doc is moved to limbo after re-query result.
964+
.expectLimboDocs(docB.key)
965+
.ackLimbo(3000, deletedDoc('collection/b', 3000))
966+
.expectLimboDocs()
967+
.expectEvents(query1, {
968+
removed: [docB]
969+
})
970+
);
971+
}
972+
);
931973
specTest(
932974
'Limbo resolution throttling with bloom filter application',
933975
[],

0 commit comments

Comments
 (0)