Skip to content

Commit

Permalink
Merge pull request #1281 from drew-gross/test-701
Browse files Browse the repository at this point in the history
Add a test to repro #701
  • Loading branch information
flovilmart committed Mar 30, 2016
2 parents b2819df + a0e7739 commit 33c9730
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/ParseACL.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// This is a port of the test suite:
// hungry/js/test/parse_acl_test.js
var rest = require('../src/rest');
var Config = require('../src/Config');
var config = new Config('test');
var auth = require('../src/Auth');

describe('Parse.ACL', () => {
it("acl must be valid", (done) => {
Expand Down Expand Up @@ -1158,4 +1162,34 @@ describe('Parse.ACL', () => {
});
});

it('regression test #701', done => {
var anonUser = {
authData: {
anonymous: {
id: '00000000-0000-0000-0000-000000000001'
}
}
};

Parse.Cloud.afterSave(Parse.User, req => {
if (!req.object.existed()) {
var user = req.object;
var acl = new Parse.ACL(user);
user.setACL(acl);
user.save(null, {useMasterKey: true}).then(user => {
new Parse.Query('_User').get(user.objectId).then(user => {
fail('should not have fetched user without public read enabled');
done();
}, error => {
expect(error.code).toEqual(Parse.Error.OBJECT_NOT_FOUND);
Parse.Cloud._removeHook('Triggers', 'afterSave', Parse.User.className);
done();
});
});
}
});

rest.create(config, auth.nobody(config), '_User', anonUser)
})

});

0 comments on commit 33c9730

Please sign in to comment.