@@ -44,19 +44,20 @@ const multiViewModelList = [
4444 { key : 'foo' , ...bar , order : 0 }
4545] ;
4646
47- const testMethod = ( fn , resultKind , mapOrMaps , keyOrKeys , expected , filter ?) => {
47+ const testMethod = ( fn , resultKind , mapOrMaps , keyOrKeys , expected , filter ?, limit ?: number ) => {
4848 const keys = keyOrKeys instanceof Array ? keyOrKeys : [ keyOrKeys ] ;
4949 describe ( 'and key' + ( keys . length === 1 ? ( ' ' + keys [ 0 ] ) : ( 's ' + JSON . stringify ( keys ) ) )
5050 + ' with ' + ( isUndefined ( filter ) ? 'no filter' : 'filter ' + JSON . stringify ( filter ) ) , ( ) => {
51- const result = fn ( mapOrMaps , keys , filter ) ;
51+ const result = fn ( mapOrMaps , keys , filter , limit ) ;
5252 let shouldReturn ;
5353 if ( resultKind === 'boolean' ) {
5454 shouldReturn = expected ;
5555 } else if ( isUndefined ( expected ) ) {
5656 shouldReturn = 'undefined' ;
5757 } else if ( expected instanceof Array ) {
5858 shouldReturn = 'an array with ' + expected . length + ' ' + ( expected . length > 1 ? 'ordered ' : '' )
59- + resultKind + ( expected . length !== 1 ? 's' : '' ) ;
59+ + resultKind + ( expected . length !== 1 ? 's' : '' )
60+ + ( isUndefined ( limit ) ? '' : ' (limited to ' + limit + ')' ) ;
6061 } else {
6162 shouldReturn = 'a ' + resultKind ;
6263 }
@@ -297,4 +298,12 @@ describe('Metadata', () => {
297298
298299 } ) ;
299300
301+ describe ( 'all method with limit' , ( ) => {
302+ const testAllWithLimit = ( mapOrMaps , keyOrKeys , expected , limit ) =>
303+ testMethod ( Metadata . all , 'value' , mapOrMaps , keyOrKeys , expected , undefined , limit ) ;
304+
305+ describe ( 'with multiMap and limit' , ( ) => {
306+ testAllWithLimit ( multiMap , 'dc.title' , [ dcTitle1 ] , 1 ) ;
307+ } ) ;
308+ } ) ;
300309} ) ;
0 commit comments