Throw error when setting authData to null (#6154)

* added ignore authData field

* add fix for Postgres

* add test for mongoDB

* add test login with provider despite invalid authData

* removed fit

* fixed ignoring authData in postgres

* Fix postgres test

* Throw error instead of ignore

* improve tests

* Add mongo test

* allow authData when not user class

* fix tests

* more tests

* add condition to synthesize authData field only in _User class

it is forbidden to add a custom field name beginning with `_`, so if the object is not `_User` , the transform should throw

* add warning log when ignoring invalid `authData` in `_User`

* add test to throw when custom field begins with underscore
This commit is contained in:
Manuel Trezza
2019-10-28 02:28:06 +01:00
committed by Diamond Lewis
parent 1c8d4a6519
commit 9d781c481f
5 changed files with 125 additions and 2 deletions

View File

@@ -276,6 +276,16 @@ describe('Parse.Object testing', () => {
done();
});
it('can set authData when not user class', async () => {
const obj = new Parse.Object('TestObject');
obj.set('authData', 'random');
await obj.save();
expect(obj.get('authData')).toBe('random');
const query = new Parse.Query('TestObject');
const object = await query.get(obj.id, { useMasterKey: true });
expect(object.get('authData')).toBe('random');
});
it('invalid class name', function(done) {
const item = new Parse.Object('Foo^bar');
item.save().then(