Ensure all roles are properly loaded #5131 (#5132)

* Fix Limitation Role #5131

Allow to manage Live Query with User that have more than 100 Parse.Roles

* Clean Up

* Add Custom Config Support and Test

* Fix Auth Test

* Switch to Async Function

* Fix restWhere

* Fix Test

* Clean Final Commit

* Lint Fix

* Need to Fix Test Callback

* Fixes broken test

* Restore find() method in spy

* adds restquery-each

* small nit

* adds changelog
This commit is contained in:
Antoine Cormouls
2018-10-20 22:45:23 +02:00
committed by Florent Vilmart
parent aa9580e59c
commit de79b70cbc
6 changed files with 157 additions and 34 deletions

View File

@@ -3,6 +3,7 @@
const auth = require('../lib/Auth');
const Config = require('../lib/Config');
const rest = require('../lib/rest');
const RestQuery = require('../lib/RestQuery');
const request = require('../lib/request');
const querystring = require('querystring');
@@ -335,3 +336,31 @@ describe('rest query', () => {
);
});
});
describe('RestQuery.each', () => {
it('should run each', async () => {
const objects = [];
while (objects.length != 10) {
objects.push(new Parse.Object('Object', { value: objects.length }));
}
const config = Config.get('test');
await Parse.Object.saveAll(objects);
const query = new RestQuery(
config,
auth.master(config),
'Object',
{ value: { $gt: 2 } },
{ limit: 2 }
);
const spy = spyOn(query, 'execute').and.callThrough();
const classSpy = spyOn(RestQuery.prototype, 'execute').and.callThrough();
const results = [];
await query.each(result => {
expect(result.value).toBeGreaterThan(2);
results.push(result);
});
expect(spy.calls.count()).toBe(0);
expect(classSpy.calls.count()).toBe(4);
expect(results.length).toBe(7);
});
});