File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,34 @@ describe('miscellaneous', function() {
225
225
} ) ;
226
226
} ) ;
227
227
228
+ it ( 'test beforeSave set object acl success' , function ( done ) {
229
+ var acl = new Parse . ACL ( {
230
+ '*' : { read : true , write : false }
231
+ } ) ;
232
+ Parse . Cloud . beforeSave ( 'BeforeSaveAddACL' , function ( req , res ) {
233
+ req . object . setACL ( acl ) ;
234
+ res . success ( ) ;
235
+ } ) ;
236
+
237
+ var obj = new Parse . Object ( 'BeforeSaveAddACL' ) ;
238
+ obj . set ( 'lol' , true ) ;
239
+ obj . save ( ) . then ( function ( ) {
240
+ Parse . Cloud . _removeHook ( 'Triggers' , 'beforeSave' , 'BeforeSaveAddACL' ) ;
241
+ var query = new Parse . Query ( 'BeforeSaveAddACL' ) ;
242
+ query . get ( obj . id ) . then ( function ( objAgain ) {
243
+ expect ( objAgain . get ( 'lol' ) ) . toBeTruthy ( ) ;
244
+ expect ( objAgain . getACL ( ) . equals ( acl ) ) ;
245
+ done ( ) ;
246
+ } , function ( error ) {
247
+ fail ( error ) ;
248
+ done ( ) ;
249
+ } ) ;
250
+ } , function ( error ) {
251
+ fail ( error ) ;
252
+ done ( ) ;
253
+ } ) ;
254
+ } ) ;
255
+
228
256
it ( 'test beforeSave returns value on create and update' , ( done ) => {
229
257
var obj = new Parse . Object ( 'BeforeSaveChanged' ) ;
230
258
obj . set ( 'foo' , 'bing' ) ;
You can’t perform that action at this time.
0 commit comments