From fe29e6e77abe2c7ae4ae7739e908dc0db64ec469 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 13 Apr 2024 16:23:55 -0500 Subject: [PATCH] test: Fix EventuallyQueue flaky tests (#2108) --- integration/test/ParseEventuallyQueueTest.js | 33 +++----------------- integration/test/helper.js | 1 + 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/integration/test/ParseEventuallyQueueTest.js b/integration/test/ParseEventuallyQueueTest.js index 1d8157553..8d5305915 100644 --- a/integration/test/ParseEventuallyQueueTest.js +++ b/integration/test/ParseEventuallyQueueTest.js @@ -195,7 +195,8 @@ describe('Parse EventuallyQueue', () => { const object = new TestObject({ hash: 'saveSecret' }); await new Promise((resolve) => parseServer.server.close(resolve)); await object.saveEventually(); - let length = await Parse.EventuallyQueue.length(); + + const length = await Parse.EventuallyQueue.length(); assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -203,14 +204,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - - while (await Parse.EventuallyQueue.length()) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query(TestObject); query.equalTo('hash', 'saveSecret'); let results = await query.find(); @@ -233,10 +226,9 @@ describe('Parse EventuallyQueue', () => { object.setACL(acl); await new Promise((resolve) => parseServer.server.close(resolve)); - await object.saveEventually(); - let length = await Parse.EventuallyQueue.length(); + const length = await Parse.EventuallyQueue.length(); assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -245,15 +237,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - - length = await Parse.EventuallyQueue.length(); - while (length) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query('TestObject'); query.equalTo('hash', 'saveSecret'); let results = await query.find(); @@ -269,7 +252,8 @@ describe('Parse EventuallyQueue', () => { await object.save(); await new Promise((resolve) => parseServer.server.close(resolve)); await object.destroyEventually(); - let length = await Parse.EventuallyQueue.length(); + const length = await Parse.EventuallyQueue.length(); + assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -277,13 +261,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - while (await Parse.EventuallyQueue.length()) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query(TestObject); query.equalTo('hash', 'deleteSecret'); let results = await query.find(); diff --git a/integration/test/helper.js b/integration/test/helper.js index c32516c95..ee22aa42a 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -84,6 +84,7 @@ const defaultConfiguration = { revokeSessionOnPasswordReset: false, allowCustomObjectId: false, allowClientClassCreation: true, + encodeParseObjectInCloudFunction: true, emailAdapter: MockEmailAdapterWithOptions({ fromAddress: 'parse@example.com', apiKey: 'k',