Skip to content

Commit

Permalink
Add failing distinct query test to address issue parse-community#8804.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilldev committed Sep 4, 2024
1 parent e944616 commit 00799fd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
});
2 changes: 1 addition & 1 deletion spec/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 00799fd

Please sign in to comment.