Skip to content

Commit

Permalink
add failing beforeSave add ACL test
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBrock committed May 13, 2016
1 parent 3d7589c commit 1987877
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,33 @@ describe('miscellaneous', function() {
});
});

it('test beforeSave set object acl success', function(done) {
var acl = new Parse.ACL({
'*': { read: false, write: false }
});
Parse.Cloud.beforeSave('BeforeSaveAddACL', function(req, res) {
req.object.setACL(acl);
res.success();
});

var obj = new Parse.Object('BeforeSaveAddACL');
obj.set('lol', true);
obj.save().then(function() {
Parse.Cloud._removeHook('Triggers', 'beforeSave', 'BeforeSaveAddACL');
var query = new Parse.Query('BeforeSaveAddACL');
query.get(obj.id).then(function(objAgain) {
expect(objAgain.getACL().equals(acl));
done();
}, function(error) {
fail(error);
done();
});
}, function(error) {
fail(error);
done();
});
});

it('test beforeSave returns value on create and update', (done) => {
var obj = new Parse.Object('BeforeSaveChanged');
obj.set('foo', 'bing');
Expand Down

0 comments on commit 1987877

Please sign in to comment.