mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-29 04:35:43 +08:00
[firestore] Correctly support dates, geopoints, DocumentSnapshots and other types in startAt, startAfter, etc
This commit is contained in:
@@ -569,6 +569,19 @@ function collectionReferenceTests({ describe, it, context, firebase, before, aft
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles snapshots', async () => {
|
||||
const collectionSnapshot = await collectionTests.orderBy('foo').get();
|
||||
return collectionTests.orderBy('foo').endAt(collectionSnapshot.docs[2])
|
||||
.get()
|
||||
.then((querySnapshot) => {
|
||||
should.equal(querySnapshot.size, 3);
|
||||
should.deepEqual(
|
||||
querySnapshot.docs.map(doc => doc.data().daz),
|
||||
[123, 234, 345],
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('endBefore', () => {
|
||||
@@ -607,6 +620,19 @@ function collectionReferenceTests({ describe, it, context, firebase, before, aft
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles snapshots', async () => {
|
||||
const collectionSnapshot = await collectionTests.orderBy('foo').get();
|
||||
return collectionTests.orderBy('foo').endBefore(collectionSnapshot.docs[2])
|
||||
.get()
|
||||
.then((querySnapshot) => {
|
||||
should.equal(querySnapshot.size, 2);
|
||||
should.deepEqual(
|
||||
querySnapshot.docs.map(doc => doc.data().daz),
|
||||
[123, 234],
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('startAt', () => {
|
||||
@@ -645,6 +671,19 @@ function collectionReferenceTests({ describe, it, context, firebase, before, aft
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles snapshots', async () => {
|
||||
const collectionSnapshot = await collectionTests.orderBy('foo').get();
|
||||
return collectionTests.orderBy('foo').startAt(collectionSnapshot.docs[2])
|
||||
.get()
|
||||
.then((querySnapshot) => {
|
||||
should.equal(querySnapshot.size, 3);
|
||||
should.deepEqual(
|
||||
querySnapshot.docs.map(doc => doc.data().daz),
|
||||
[345, 456, 567],
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('startAfter', () => {
|
||||
@@ -683,6 +722,19 @@ function collectionReferenceTests({ describe, it, context, firebase, before, aft
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles snapshot', async () => {
|
||||
const collectionSnapshot = await collectionTests.orderBy('foo').get();
|
||||
return collectionTests.orderBy('foo').startAfter(collectionSnapshot.docs[2])
|
||||
.get()
|
||||
.then((querySnapshot) => {
|
||||
should.equal(querySnapshot.size, 2);
|
||||
should.deepEqual(
|
||||
querySnapshot.docs.map(doc => doc.data().daz),
|
||||
[456, 567],
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
||||
Reference in New Issue
Block a user