@@ -25,6 +25,42 @@ describe("Queries",function(){
2525
2626 } ) ;
2727
28+ describe ( "#cloudQuery" , function ( ) {
29+ it ( "should return results." , function ( done ) {
30+ AV . Cloud . doCloudQuery ( 'select * from GameScore' ) . then ( function ( result ) {
31+ console . dir ( result ) ;
32+ var results = result . results ;
33+ expect ( results . length ) . to . be ( 100 ) ;
34+ expect ( results [ 0 ] . className ) . to . be ( "GameScore" ) ;
35+ expect ( result . count ) . to . be ( undefined ) ;
36+ expect ( result . className ) . to . be ( 'GameScore' ) ;
37+ done ( ) ;
38+ } ) ;
39+ } ) ;
40+ it ( "should return limited results." , function ( done ) {
41+ AV . Cloud . doCloudQuery ( 'select * from GameScore limit 10' ) . then ( function ( result ) {
42+ console . dir ( result ) ;
43+ var results = result . results ;
44+ expect ( results . length ) . to . be ( 10 ) ;
45+ expect ( results [ 0 ] . className ) . to . be ( "GameScore" ) ;
46+ expect ( result . count ) . to . be ( undefined ) ;
47+ expect ( result . className ) . to . be ( 'GameScore' ) ;
48+ done ( ) ;
49+ } ) ;
50+ } ) ;
51+ it ( "should return count value." , function ( done ) {
52+ AV . Cloud . doCloudQuery ( 'select *,count(objectId) from GameScore limit 10' ) . then ( function ( result ) {
53+ console . dir ( result ) ;
54+ var results = result . results ;
55+ expect ( results . length ) . to . be ( 10 ) ;
56+ expect ( results [ 0 ] . className ) . to . be ( "GameScore" ) ;
57+ expect ( result . count ) . to . be . an ( 'number' ) ;
58+ expect ( result . className ) . to . be ( 'GameScore' ) ;
59+ done ( ) ;
60+ } ) ;
61+ } ) ;
62+ } ) ;
63+
2864 describe ( "#save&query()" , function ( ) {
2965 it ( "should length + 1" , function ( done ) {
3066 query = new AV . Query ( GameScore ) ;
0 commit comments