Prevent invalid column names (className and length) (#7053)
* Prevent invalid column names * remove className as invalid * remove className from beforeSave hook response * improve tests
This commit is contained in:
@@ -216,6 +216,21 @@ describe('Cloud Code', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('test beforeSave with invalid field', async () => {
|
||||
Parse.Cloud.beforeSave('BeforeSaveChanged', function (req) {
|
||||
req.object.set('length', 0);
|
||||
});
|
||||
|
||||
const obj = new Parse.Object('BeforeSaveChanged');
|
||||
obj.set('foo', 'bar');
|
||||
try {
|
||||
await obj.save();
|
||||
fail('should not succeed');
|
||||
} catch (e) {
|
||||
expect(e.message).toBe('Invalid field name: length.');
|
||||
}
|
||||
});
|
||||
|
||||
it("test beforeSave changed object fail doesn't change object", async function () {
|
||||
Parse.Cloud.beforeSave('BeforeSaveChanged', function (req) {
|
||||
if (req.object.has('fail')) {
|
||||
|
||||
Reference in New Issue
Block a user