mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 17:42:24 +08:00
tests(firestore): additional tests for numeric where clauses (#3895)
* Added additional tests for numeric where clauses * removed .only Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
This commit is contained in:
@@ -410,4 +410,32 @@ describe('firestore().collection().where()', () => {
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
|
||||
it('should correctly query integer values with in operator', async () => {
|
||||
const ref = firebase.firestore().collection('v6');
|
||||
|
||||
await ref.add({ status: 1 });
|
||||
|
||||
const items = [];
|
||||
await ref
|
||||
.where('status', 'in', [1, 2])
|
||||
.get()
|
||||
.then($ => $.forEach(doc => items.push(doc.data())));
|
||||
|
||||
items.length.should.equal(1);
|
||||
});
|
||||
|
||||
it('should correctly query integer values with array-contains operator', async () => {
|
||||
const ref = firebase.firestore().collection('v6');
|
||||
|
||||
await ref.add({ status: [1, 2, 3] });
|
||||
|
||||
const items = [];
|
||||
await ref
|
||||
.where('status', 'array-contains', 2)
|
||||
.get()
|
||||
.then($ => $.forEach(doc => items.push(doc.data())));
|
||||
|
||||
items.length.should.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user