Skip to content

Commit

Permalink
reduced ParseLivequery.spec.js timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
FransGH committed Oct 30, 2021
1 parent 5709449 commit 30c9bae
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const validatorFail = () => {
throw 'you are not authorized';
};

console.log('jasmine.ASYNC_TEST_WAIT_TIME=' + jasmine.ASYNC_TEST_WAIT_TIME);

describe('ParseLiveQuery', function () {
it('access user on onLiveQueryEvent disconnect', async done => {
await reconfigureServer({
Expand Down Expand Up @@ -310,14 +312,10 @@ describe('ParseLiveQuery', function () {
Parse.Cloud.afterLiveQueryEvent('TestObject', req => {
const current = req.object;
const original = req.original;

setTimeout(() => {
done();
}, 2000);

if (current.get('foo') != original.get('foo')) {
req.sendEvent = false;
}
setTimeout(done, 1000);
});

const query = new Parse.Query(TestObject);
Expand Down Expand Up @@ -733,9 +731,7 @@ describe('ParseLiveQuery', function () {
});
object.set({ foo: 'bar' });
await object.save();
setTimeout(async () => {
done();
}, 1000);
setTimeout(done, 1000);
});

it('can return a new beforeSubscribe query', async done => {
Expand Down Expand Up @@ -922,9 +918,9 @@ describe('ParseLiveQuery', function () {
});
await obj1.save();
await Parse.User.logOut();
await new Promise(resolve => setTimeout(resolve, 200));
await new Promise(resolve => setTimeout(resolve, 100));
await obj2.save();
await new Promise(resolve => setTimeout(resolve, 200));
await new Promise(resolve => setTimeout(resolve, 100));
done();
});

Expand Down Expand Up @@ -970,7 +966,7 @@ describe('ParseLiveQuery', function () {
user.set('foo', 'bar');
await user.save();
await user.destroy();
await new Promise(resolve => setTimeout(resolve, 500));
await new Promise(resolve => setTimeout(resolve, 10));
for (const key of events) {
expect(calls[key]).toHaveBeenCalled();
}
Expand All @@ -980,8 +976,6 @@ describe('ParseLiveQuery', function () {
const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient();
client.close();
// Wait for live query client to disconnect
setTimeout(() => {
done();
}, 1000);
setTimeout(done, 10);
});
});

0 comments on commit 30c9bae

Please sign in to comment.