Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Parse.Query.limit() parameter in Parse.Query.count() query is ignored #8812

Open
wants to merge 5 commits into
base: alpha
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,26 @@
});
});

it('should limit count query if limit is set', async done => {
hej2010 marked this conversation as resolved.
Show resolved Hide resolved
const hook = {
method: function (req) {
expect(req.count).toBe(true);
return Promise.resolve();
},
};
spyOn(hook, 'method').and.callThrough();
Parse.Cloud.beforeFind('Stuff', hook.method);
hej2010 marked this conversation as resolved.
Show resolved Hide resolved

for (let i = 0; i < 10; i++) {
await new Parse.Object('Stuff').set('i', i).save(null, { useMasterKey: true });
}
hej2010 marked this conversation as resolved.
Show resolved Hide resolved
new Parse.Query('Stuff').limit(5).count().then(count => {
expect(count).toBe(5);
expect(hook.method).toHaveBeenCalled();
done();
});
hej2010 marked this conversation as resolved.
Show resolved Hide resolved
});

Check failure on line 2806 in spec/CloudCode.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
it('can set a pointer object in afterFind', async () => {
const obj = new Parse.Object('MyObject');
await obj.save();
Expand Down