File tree Expand file tree Collapse file tree
packages/cloud_firestore/cloud_firestore/example/integration_test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1023,6 +1023,29 @@ void runQueryTests() {
10231023 expect (snapshot.docs[1 ].id, equals ('doc4' ));
10241024 });
10251025
1026+ test ('startAfterDocument() preserves Timestamp cursor precision' ,
1027+ () async {
1028+ CollectionReference <Map <String , dynamic >> collection =
1029+ await initializeTest ('startAfter-document-timestamp-precision' );
1030+ await collection.doc ('doc1' ).set ({
1031+ 'createdAt' : Timestamp (1 , 123456789 ),
1032+ });
1033+
1034+ Query <Map <String , dynamic >> baseQuery = collection.orderBy ('createdAt' );
1035+ QuerySnapshot <Map <String , dynamic >> firstPage =
1036+ await baseQuery.limit (50 ).get ();
1037+
1038+ expect (firstPage.docs.length, equals (1 ));
1039+ expect (firstPage.docs.first.id, equals ('doc1' ));
1040+
1041+ QuerySnapshot <Map <String , dynamic >> nextPage = await baseQuery
1042+ .startAfterDocument (firstPage.docs.last)
1043+ .limit (50 )
1044+ .get ();
1045+
1046+ expect (nextPage.docs, isEmpty);
1047+ });
1048+
10261049 testWidgets (
10271050 'throws exception without orderBy() on field used for inequality query' ,
10281051 (_) async {
You can’t perform that action at this time.
0 commit comments