@@ -3684,6 +3684,75 @@ describe('Parse.Query testing', () => {
36843684 } ) ;
36853685 } ) ;
36863686
3687+ it ( "includeAll" , ( done ) => {
3688+ const child1 = new TestObject ( { foo : 'bar' , name : 'al' } ) ;
3689+ const child2 = new TestObject ( { foo : 'baz' , name : 'flo' } ) ;
3690+ const child3 = new TestObject ( { foo : 'bad' , name : 'mo' } ) ;
3691+ const parent = new Container ( { child1, child2, child3 } ) ;
3692+ Parse . Object . saveAll ( [ parent , child1 , child2 , child3 ] ) . then ( ( ) => {
3693+ const options = Object . assign ( { } , masterKeyOptions , {
3694+ body : {
3695+ where : { objectId : parent . id } ,
3696+ includeAll : true ,
3697+ }
3698+ } ) ;
3699+ return rp . get ( Parse . serverURL + "/classes/Container" , options ) ;
3700+ } ) . then ( ( resp ) => {
3701+ const result = resp . results [ 0 ] ;
3702+ equal ( result . child1 . foo , 'bar' ) ;
3703+ equal ( result . child2 . foo , 'baz' ) ;
3704+ equal ( result . child3 . foo , 'bad' ) ;
3705+ equal ( result . child1 . name , 'al' ) ;
3706+ equal ( result . child2 . name , 'flo' ) ;
3707+ equal ( result . child3 . name , 'mo' ) ;
3708+ done ( ) ;
3709+ } ) ;
3710+ } ) ;
3711+
3712+ it ( 'select nested keys 2 level includeAll' , ( done ) => {
3713+ const Foobar = new Parse . Object ( 'Foobar' ) ;
3714+ const BarBaz = new Parse . Object ( 'Barbaz' ) ;
3715+ const Bazoo = new Parse . Object ( 'Bazoo' ) ;
3716+ const Tang = new Parse . Object ( 'Tang' ) ;
3717+
3718+ Bazoo . set ( 'some' , 'thing' ) ;
3719+ Bazoo . set ( 'otherSome' , 'value' ) ;
3720+ Bazoo . save ( ) . then ( ( ) => {
3721+ BarBaz . set ( 'key' , 'value' ) ;
3722+ BarBaz . set ( 'otherKey' , 'value' ) ;
3723+ BarBaz . set ( 'bazoo' , Bazoo ) ;
3724+ return BarBaz . save ( ) ;
3725+ } ) . then ( ( ) => {
3726+ Tang . set ( 'clan' , 'wu' ) ;
3727+ return Tang . save ( ) ;
3728+ } ) . then ( ( ) => {
3729+ Foobar . set ( 'foo' , 'bar' ) ;
3730+ Foobar . set ( 'fizz' , 'buzz' ) ;
3731+ Foobar . set ( 'barBaz' , BarBaz ) ;
3732+ Foobar . set ( 'group' , Tang ) ;
3733+ return Foobar . save ( ) ;
3734+ } ) . then ( ( savedFoobar ) => {
3735+ const options = Object . assign ( { } , masterKeyOptions , {
3736+ body : {
3737+ where : { objectId : savedFoobar . id } ,
3738+ includeAll : true ,
3739+ keys : 'fizz,barBaz.key,barBaz.bazoo.some' ,
3740+ }
3741+ } ) ;
3742+ return rp . get ( Parse . serverURL + "/classes/Foobar" , options ) ;
3743+ } ) . then ( ( resp ) => {
3744+ const result = resp . results [ 0 ] ;
3745+ equal ( result . group . clan , 'wu' ) ;
3746+ equal ( result . foo , undefined ) ;
3747+ equal ( result . fizz , 'buzz' ) ;
3748+ equal ( result . barBaz . key , 'value' ) ;
3749+ equal ( result . barBaz . otherKey , undefined ) ;
3750+ equal ( result . barBaz . bazoo . some , 'thing' ) ;
3751+ equal ( result . barBaz . bazoo . otherSome , undefined ) ;
3752+ done ( ) ;
3753+ } )
3754+ } ) ;
3755+
36873756 it ( 'select nested keys 2 level without include (issue #3185)' , function ( done ) {
36883757 const Foobar = new Parse . Object ( 'Foobar' ) ;
36893758 const BarBaz = new Parse . Object ( 'Barbaz' ) ;
0 commit comments