@@ -11,10 +11,8 @@ var BackbonePerson = AV.Object.extend('Person');
1111describe ( 'Objects' , function ( ) {
1212 var objId ;
1313 var gameScore = GameScore . new ( ) ;
14- after ( function ( done ) {
15- gameScore . destroy ( ) . then ( function ( ) {
16- done ( ) ;
17- } ) ;
14+ after ( function ( ) {
15+ return gameScore . destroy ( ) ;
1816 } ) ;
1917 it ( 'getter/setter compatible' , function ( ) {
2018 Object . defineProperty ( Post . prototype , 'name' , {
@@ -138,14 +136,14 @@ describe('Objects', function(){
138136 } ) ;
139137
140138 describe ( 'Fetching Objects' , ( ) => {
141- it ( 'fetch' , ( ) =>
139+ it ( 'fetch' , ( ) =>
142140 AV . Object . createWithoutData ( 'GameScore' , gameScore . id ) . fetch ( ) . then ( score => {
143141 expect ( score . get ( 'score' ) ) . to . be . a ( 'number' ) ;
144142 expect ( score . createdAt ) . to . be . a ( Date ) ;
145143 expect ( score . id ) . to . be . eql ( gameScore . id ) ;
146144 } )
147145 ) ;
148- it ( 'fetchAll' , ( ) =>
146+ it ( 'fetchAll' , ( ) =>
149147 AV . Object . fetchAll ( [
150148 AV . Object . createWithoutData ( 'GameScore' , gameScore . id ) ,
151149 AV . Object . createWithoutData ( 'GameScore' , gameScore . id ) ,
@@ -252,7 +250,7 @@ describe('Objects', function(){
252250 query . include ( "parent" ) ;
253251 return query . get ( myComment . id ) ;
254252 } ) . then ( function ( obj ) {
255- expect ( obj . get ( "parent" ) . get ( "title" ) ) . to . be ( "post1" ) ;
253+ expect ( obj . get ( "parent" ) . get ( "title" ) ) . to . be ( "post1" ) ;
256254 } ) ;
257255 } ) ;
258256
@@ -358,8 +356,20 @@ describe('Objects', function(){
358356 } ) ;
359357 } ) ;
360358 } ) ;
361-
362359
360+ it ( "fetchOptions keys" , function ( ) {
361+ var person = new Person ( ) ;
362+ person . set ( 'pname' , 'dennis' ) ;
363+ person . set ( 'age' , 1 )
364+ return person . save ( ) . then ( ( ) =>
365+ AV . Object . createWithoutData ( 'Person' , person . id ) . fetch ( {
366+ keys : [ 'pname' ] ,
367+ } )
368+ ) . then ( function ( person ) {
369+ expect ( person . get ( 'pname' ) ) . to . be ( 'dennis' ) ;
370+ expect ( person . get ( 'age' ) ) . to . be ( undefined ) ;
371+ } ) ;
372+ } ) ;
363373
364374 } ) ;
365375
0 commit comments