Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mila/bloom filter add integration test #7045

Merged
merged 6 commits into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/firestore/test/integration/api/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
Query,
query,
QuerySnapshot,
runTransaction,
setDoc,
startAfter,
startAt,
Expand Down Expand Up @@ -1614,6 +1615,32 @@ apiDescribe('Queries', (persistence: boolean) => {
});
});
});

// eslint-disable-next-line no-restricted-properties
(persistence ? it.skip : it)(
'resuming a query should remove deleted documents indicated by existence filter',
() => {
const testDocs: { [key: string]: object } = {};
for (let i = 1; i <= 100; i++) {
testDocs['doc' + i] = { key: i };
}
return withTestCollection(persistence, testDocs, async (coll, db) => {
const snapshot1 = await getDocs(coll);
expect(snapshot1.size).to.equal(100);
// Delete 50 docs in transaction so that it doesn't affect local cache.
await runTransaction(db, async txn => {
for (let i = 1; i <= 50; i++) {
txn.delete(doc(coll, 'doc' + i));
}
});
// Wait 10 seconds, during which Watch will stop tracking the query
// and will send an existence filter rather than "delete" events.
await new Promise(resolve => setTimeout(resolve, 10000));
const snapshot2 = await getDocs(coll);
expect(snapshot2.size).to.equal(50);
});
}
).timeout('20s');
});

function verifyDocumentChange<T>(
Expand Down