@@ -783,6 +783,25 @@ describe('CollectionReference class', () => {
783783 expect ( missingDocs . map ( doc => doc . id ) ) . to . have . members ( [ 'b' ] ) ;
784784 } ) ;
785785
786+ it ( 'lists documents (more than the max page size)' , async ( ) => {
787+ const batch = firestore . batch ( ) ;
788+ const expectedResults = [ ] ;
789+ for ( let i = 0 ; i < 400 ; i ++ ) {
790+ const docRef = randomCol . doc ( `${ i } ` . padStart ( 3 , '0' ) ) ;
791+ batch . set ( docRef , { id : i } ) ;
792+ expectedResults . push ( docRef . id ) ;
793+ }
794+ await batch . commit ( ) ;
795+
796+ const documentRefs = await randomCol . listDocuments ( ) ;
797+
798+ const actualDocIds = documentRefs
799+ . map ( dr => dr . id )
800+ . sort ( ( a , b ) => a . localeCompare ( b ) ) ;
801+
802+ expect ( actualDocIds ) . to . deep . equal ( expectedResults ) ;
803+ } ) ;
804+
786805 it ( 'supports withConverter()' , async ( ) => {
787806 const ref = await firestore
788807 . collection ( 'col' )
@@ -1176,11 +1195,13 @@ describe('DocumentReference class', () => {
11761195 } ) ;
11771196
11781197 it ( 'has listCollections() method' , ( ) => {
1179- const collections = [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' ] ;
1198+ const collections : string [ ] = [ ] ;
11801199 const promises : Array < Promise < { } > > = [ ] ;
11811200
1182- for ( const collection of collections ) {
1183- promises . push ( randomCol . doc ( `doc/${ collection } /doc` ) . create ( { } ) ) ;
1201+ for ( let i = 0 ; i < 400 ; i ++ ) {
1202+ const collectionId = i . toString ( ) . padStart ( 3 , '0' ) ;
1203+ promises . push ( randomCol . doc ( `doc/${ collectionId } /doc` ) . create ( { } ) ) ;
1204+ collections . push ( collectionId ) ;
11841205 }
11851206
11861207 return Promise . all ( promises )
0 commit comments