Skip to content
Open
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
37 changes: 36 additions & 1 deletion test/replication-firestore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
orderBy,
limit,
getDoc,
QueryConstraint
QueryConstraint,
or
} from 'firebase/firestore';
import {
FirestoreOptions,
Expand Down Expand Up @@ -346,6 +347,40 @@

collection.database.close();
});

it('should sync documents matching an or constraint from firestore', async () => {
const firestoreState = getFirestoreState();

const h1 = makeFirestoreHumanDocument(schemaObjects.humanData('alice', 25, 'alice-passport'));
const h2 = makeFirestoreHumanDocument(schemaObjects.humanData('bob', 45, 'bob-passport'));
const h3 = makeFirestoreHumanDocument(schemaObjects.humanData('charlie', 30, 'charlie-passport'));
const h4 = makeFirestoreHumanDocument(schemaObjects.humanData('diana', 50, 'diana-passport'));

await setDoc(DocRef(firestoreState.collection, 'alice-passport'), h1);
await setDoc(DocRef(firestoreState.collection, 'bob-passport'), h2);
await setDoc(DocRef(firestoreState.collection, 'charlie-passport'), h3);
await setDoc(DocRef(firestoreState.collection, 'diana-passport'), h4);

const collection = await humansCollection.create(0);

await syncOnce(collection, firestoreState, {
pull: {
filter: or(

Check failure on line 368 in test/replication-firestore.test.ts

View workflow job for this annotation

GitHub Actions / test-code-style

Type 'QueryCompositeFilterConstraint' is not assignable to type 'QueryFieldFilterConstraint | QueryFieldFilterConstraint[] | undefined'.
where('firstName', '==', 'alice'),
where('firstName', '==', 'diana')
)
},
push: {},
});

const allLocalDocs = await collection.find().exec();

assert.strictEqual(allLocalDocs.length, 2);
const passportIds = allLocalDocs.map(d => d.passportId).sort();
assert.deepStrictEqual(passportIds, ['alice-passport', 'diana-passport']);

collection.database.close();
});
});
describe('issues', () => {
it('#4698 adding items quickly does not send them to the server', async () => {
Expand Down
Loading