* 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:
committed by
Florent Vilmart
parent
aa9580e59c
commit
de79b70cbc
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user