This repository was archived by the owner on Jan 12, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,14 +23,16 @@ export default function(query, paginate) {
2323 $sort : query . $sort ,
2424 $limit : getLimit ( parse ( query . $limit ) , paginate ) ,
2525 $skip : parse ( query . $skip ) ,
26- $select : query . $select
26+ $select : query . $select ,
27+ $populate : query . $populate
2728 } ;
2829
2930 // Remove the params from the query's conditions.
3031 delete query . $sort ;
3132 delete query . $limit ;
3233 delete query . $skip ;
3334 delete query . $select ;
35+ delete query . $populate ;
3436
3537 return filters ;
3638}
Original file line number Diff line number Diff line change @@ -115,4 +115,26 @@ describe('Feathers Query Filters', function() {
115115 expect ( result . $select ) . to . be . undefined ;
116116 } ) ;
117117 } ) ;
118+
119+ describe ( '$populate' , function ( ) {
120+ beforeEach ( function ( ) {
121+ this . query = { $populate : 1 } ;
122+ } ) ;
123+
124+ it ( 'returns $populate when present in query' , function ( ) {
125+ var result = filter ( this . query ) ;
126+ expect ( result . $populate ) . to . equal ( 1 ) ;
127+ } ) ;
128+
129+ it ( 'removes $populate from query when present' , function ( ) {
130+ filter ( this . query ) ;
131+ expect ( this . query ) . to . deep . equal ( { } ) ;
132+ } ) ;
133+
134+ it ( 'returns undefined when not present in query' , function ( ) {
135+ var query = { $foo : 1 } ;
136+ var result = filter ( query ) ;
137+ expect ( result . $populate ) . to . be . undefined ;
138+ } ) ;
139+ } ) ;
118140} ) ;
You can’t perform that action at this time.
0 commit comments