@@ -25,6 +25,52 @@ 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+ it ( "should return syntax error." , function ( done ) {
63+ AV . Cloud . doCloudQuery ( 'select * GameScore limit 10' ) . then ( function ( ) {
64+ throw "Shoud not be successfully." ;
65+ } ,
66+ function ( error ) {
67+ console . dir ( error ) ;
68+ expect ( error ) . to . be . an ( AV . Error ) ;
69+ done ( ) ;
70+ } ) ;
71+ } ) ;
72+ } ) ;
73+
2874 describe ( "#save&query()" , function ( ) {
2975 it ( "should length + 1" , function ( done ) {
3076 query = new AV . Query ( GameScore ) ;
0 commit comments