diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 6020e2be7d..2f4b4d8ff7 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -5275,4 +5275,29 @@ describe('Parse.Query testing', () => { // Validate expect(result.executionStats).not.toBeUndefined(); }); + + it('Query fails when wrapped within eachBatch and direct access is set to true', async () => { + await reconfigureServer({ + directAccess: true, + }); + + const user = new Parse.User(); + user.set('username', 'foo'); + user.set('password', 'bar'); + await user.save(); + + const score = new Parse.Object('Score'); + score.set('player', user); + score.set('score', 1); + await score.save(); + + await new Parse.Query('_User') + .equalTo('objectId', user.id) + .eachBatch(async ([user]) => { + const score = await new Parse.Query('Score') + .equalTo('player', user) + .distinct('score', { useMasterKey: true }); + expect(score).toEqual([1]); + }, { useMasterKey: true }); + }); }); diff --git a/spec/helper.js b/spec/helper.js index c09a0c4eb4..78fc51304f 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -187,7 +187,7 @@ const reconfigureServer = async (changedConfiguration = {}) => { }); cache.clear(); parseServer = await ParseServer.startApp(newConfiguration); - Parse.CoreManager.setRESTController(RESTController); + // Parse.CoreManager.setRESTController(RESTController); parseServer.expressApp.use('/1', err => { console.error(err); fail('should not call next');