@@ -117,6 +117,9 @@ describe('Queries', function () {
117117 before ( function ( ) {
118118 return new GameScore ( {
119119 playerName : 'testname' ,
120+ score : 1000 ,
121+ players : [ 'a' , 'b' ] ,
122+ test : new TestClass ( { foo : 'bar' } ) ,
120123 } ) . save ( ) . then ( gameScore => this . gameScore = gameScore ) ;
121124 } ) ;
122125
@@ -142,17 +145,55 @@ describe('Queries', function () {
142145
143146 it ( 'sizeEqualTo' , function ( ) {
144147 var gameScore = new GameScore ( ) ;
145- return gameScore . save ( {
146- players : [ 'a' , 'b' ]
147- } ) . then ( function ( ) {
148- query = new AV . Query ( GameScore ) ;
149- query . sizeEqualTo ( 'players' , 2 ) ;
150- return query . first ( ) ;
151- } ) . then ( function ( object ) {
148+ var query = new AV . Query ( GameScore ) ;
149+ query . sizeEqualTo ( 'players' , 2 ) ;
150+ return query . first ( ) . then ( function ( object ) {
152151 expect ( object . get ( 'players' ) . length ) . to . be ( 2 ) ;
153152 return gameScore . destroy ( ) ;
154153 } ) ;
155154 } ) ;
155+
156+ it ( 'select with multi params' , function ( ) {
157+ return new AV . Query ( GameScore )
158+ . select ( 'test' , 'score' )
159+ . equalTo ( 'objectId' , this . gameScore . id )
160+ . find ( )
161+ . then ( ( [ gameScore ] ) => {
162+ expect ( gameScore . get ( 'score' ) ) . to . be ( 1000 ) ;
163+ expect ( gameScore . get ( 'playerName' ) ) . to . be ( undefined ) ;
164+ } ) ;
165+ } ) ;
166+
167+ it ( 'select' , function ( ) {
168+ return new AV . Query ( GameScore )
169+ . select ( [ 'test' , 'score' ] )
170+ . equalTo ( 'objectId' , this . gameScore . id )
171+ . find ( )
172+ . then ( ( [ gameScore ] ) => {
173+ expect ( gameScore . get ( 'score' ) ) . to . be ( 1000 ) ;
174+ expect ( gameScore . get ( 'playerName' ) ) . to . be ( undefined ) ;
175+ } ) ;
176+ } ) ;
177+
178+ it ( 'include with multi params' , function ( ) {
179+ return new AV . Query ( GameScore )
180+ . include ( 'score' , 'test' )
181+ . equalTo ( 'objectId' , this . gameScore . id )
182+ . find ( )
183+ . then ( ( [ gameScore ] ) => {
184+ expect ( gameScore . get ( 'test' ) . get ( 'foo' ) ) . to . be ( 'bar' ) ;
185+ } ) ;
186+ } ) ;
187+
188+ it ( 'include' , function ( ) {
189+ return new AV . Query ( GameScore )
190+ . include ( [ 'score' , 'test' ] )
191+ . equalTo ( 'objectId' , this . gameScore . id )
192+ . find ( )
193+ . then ( ( [ gameScore ] ) => {
194+ expect ( gameScore . get ( 'test' ) . get ( 'foo' ) ) . to . be ( 'bar' ) ;
195+ } ) ;
196+ } ) ;
156197 } ) ;
157198
158199 describe ( 'Query with different condtions' , function ( ) {
0 commit comments