From 3d10062bd70f591c942df048cee56d6531c7fa1d Mon Sep 17 00:00:00 2001 From: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> Date: Fri, 17 Nov 2023 15:54:17 +0100 Subject: [PATCH 1/4] Update CloudCode.spec.js Signed-off-by: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> --- spec/CloudCode.spec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index a1c8b48bfd..9bc205a130 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -2784,6 +2784,26 @@ describe('afterFind hooks', () => { }); }); + it('should limit count query if limit is set', async done => { + const hook = { + method: function (req) { + expect(req.count).toBe(true); + return Promise.resolve(); + }, + }; + spyOn(hook, 'method').and.callThrough(); + Parse.Cloud.beforeFind('Stuff', hook.method); + + for (let i = 0; i < 10; i++) { + await new Parse.Object('Stuff').set('i', i).save(null, { useMasterKey: true }); + } + new Parse.Query('Stuff').limit(5).count().then(count => { + expect(count).toBe(5); + expect(hook.method).toHaveBeenCalled(); + done(); + }); + }); + it('can set a pointer object in afterFind', async () => { const obj = new Parse.Object('MyObject'); await obj.save(); From 934f3233b93333f7c68277b2a3da0367b2cc53de Mon Sep 17 00:00:00 2001 From: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:39:45 +0100 Subject: [PATCH 2/4] Update CloudCode.spec.js Signed-off-by: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> --- spec/CloudCode.spec.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 9bc205a130..7d19ae4665 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -1781,6 +1781,16 @@ describe('Cloud Code', () => { count === 2 ? done() : fail(); }); + it('should limit count query if limit is set', async () => { + const queries = []; + for (let i = 0; i < 10; i++) { + queries.push(new Parse.Object('Stuff').set('i', i).save()); + } + await Promise.all(queries); + const count = await (new Parse.Query('Stuff').limit(5).count()); + expect(count).toBe(5); + }); + /** * Verifies that an afterSave hook throwing an exception * will not prevent a successful save response from being returned @@ -2784,26 +2794,6 @@ describe('afterFind hooks', () => { }); }); - it('should limit count query if limit is set', async done => { - const hook = { - method: function (req) { - expect(req.count).toBe(true); - return Promise.resolve(); - }, - }; - spyOn(hook, 'method').and.callThrough(); - Parse.Cloud.beforeFind('Stuff', hook.method); - - for (let i = 0; i < 10; i++) { - await new Parse.Object('Stuff').set('i', i).save(null, { useMasterKey: true }); - } - new Parse.Query('Stuff').limit(5).count().then(count => { - expect(count).toBe(5); - expect(hook.method).toHaveBeenCalled(); - done(); - }); - }); - it('can set a pointer object in afterFind', async () => { const obj = new Parse.Object('MyObject'); await obj.save(); From b60e6ea00df684c04592f2bb3c76e781789834eb Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:23:56 +0100 Subject: [PATCH 3/4] Update spec/CloudCode.spec.js Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- spec/CloudCode.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 7d19ae4665..8e691c7542 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -1782,11 +1782,11 @@ describe('Cloud Code', () => { }); it('should limit count query if limit is set', async () => { - const queries = []; + const promises = []; for (let i = 0; i < 10; i++) { - queries.push(new Parse.Object('Stuff').set('i', i).save()); + promises.push(new Parse.Object('Stuff').set('i', i).save()); } - await Promise.all(queries); + await Promise.all(promises); const count = await (new Parse.Query('Stuff').limit(5).count()); expect(count).toBe(5); }); From c946ccc7b235223cbc1e764a309a560b90c6e0dd Mon Sep 17 00:00:00 2001 From: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> Date: Sat, 18 Nov 2023 14:41:23 +0100 Subject: [PATCH 4/4] space Signed-off-by: Rikard Teodorsson <9367038+hej2010@users.noreply.github.com> --- spec/CloudCode.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 8e691c7542..44a8441fb8 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -1784,7 +1784,7 @@ describe('Cloud Code', () => { it('should limit count query if limit is set', async () => { const promises = []; for (let i = 0; i < 10; i++) { - promises.push(new Parse.Object('Stuff').set('i', i).save()); + promises.push(new Parse.Object('Stuff').set('i', i).save()); } await Promise.all(promises); const count = await (new Parse.Query('Stuff').limit(5).count());