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 12, 2016
1 parent 3d7589c commit 0758275
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,25 @@ describe('miscellaneous', function() {
});
});

it('test beforeSave set object acl success', function(done) {
var obj = new Parse.Object('BeforeSaveAddACL');
obj.set('lol', true);
obj.save().then(function() {
var query = new Parse.Query('BeforeSaveAddACL');
query.get(obj.id).then(function(objAgain) {
var expectedACL = new Parse.ACL({'*': {read: false, write: false}});
expect(objAgain.getACL()).toEqual(expectedACL);
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
5 changes: 5 additions & 0 deletions spec/cloud/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ Parse.Cloud.beforeSave('BeforeSaveChanged', function(req, res) {
res.success();
});

Parse.Cloud.beforeSave('BeforeSaveAddACL', function(req, res) {
req.object.setACL(new Parse.ACL({'*': {read: false, write: false}}));
res.success();
});

Parse.Cloud.afterSave('AfterSaveTest', function(req) {
var obj = new Parse.Object('AfterSaveProof');
obj.set('proof', req.object.id);
Expand Down

0 comments on commit 0758275

Please sign in to comment.