fix: Cloud Code trigger beforeSave does not work with Parse.Role (#8320)
This commit is contained in:
@@ -1558,6 +1558,22 @@ describe('Cloud Code', () => {
|
||||
expect(obj.get('foo')).toBe('bar');
|
||||
});
|
||||
|
||||
it('create role with name and ACL and a beforeSave', async () => {
|
||||
Parse.Cloud.beforeSave(Parse.Role, ({ object }) => {
|
||||
return object;
|
||||
});
|
||||
|
||||
const obj = new Parse.Role('TestRole', new Parse.ACL({ '*': { read: true, write: true } }));
|
||||
await obj.save();
|
||||
|
||||
expect(obj.getACL()).toEqual(new Parse.ACL({ '*': { read: true, write: true } }));
|
||||
expect(obj.get('name')).toEqual('TestRole');
|
||||
await obj.fetch();
|
||||
|
||||
expect(obj.getACL()).toEqual(new Parse.ACL({ '*': { read: true, write: true } }));
|
||||
expect(obj.get('name')).toEqual('TestRole');
|
||||
});
|
||||
|
||||
it('can unset in afterSave', async () => {
|
||||
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
|
||||
if (!object.existed()) {
|
||||
|
||||
Reference in New Issue
Block a user