Allow protectedFields for Authenticated users and Public. Fix userField with keys/excludedKeys (#6415)

* fix error message and test it

* protected fields fixes

* clean

* remove duplicate test, add some comments

* no need for 'requiresAuthentication'
This commit is contained in:
Old Grandpa
2020-02-19 12:34:08 +03:00
committed by GitHub
parent ca1ae336c9
commit 292bdb713a
9 changed files with 1390 additions and 45 deletions

View File

@@ -4868,4 +4868,36 @@ describe('Parse.Query testing', () => {
const results = await query.find();
equal(results[0].get('array').length, 105);
});
it('exclude keys (sdk query)', async done => {
const obj = new TestObject({ foo: 'baz', hello: 'world' });
await obj.save();
const query = new Parse.Query('TestObject');
query.exclude('foo');
const object = await query.get(obj.id);
expect(object.get('foo')).toBeUndefined();
expect(object.get('hello')).toBe('world');
done();
});
xit('todo: exclude keys with select key (sdk query get)', async done => {
// there is some problem with js sdk caching
const obj = new TestObject({ foo: 'baz', hello: 'world' });
await obj.save();
const query = new Parse.Query('TestObject');
query.withJSON({
keys: 'hello',
excludeKeys: 'hello',
});
const object = await query.get(obj.id);
expect(object.get('foo')).toBeUndefined();
expect(object.get('hello')).toBeUndefined();
done();
});
});