Skip to content

Commit

Permalink
Merge branch 'fix-lts-ci-7659' into fix-graphql-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
FransGH committed Oct 30, 2021
2 parents d830eac + d032063 commit 974e903
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"form-data": "3.0.0",
"husky": "4.2.5",
"jasmine": "3.5.0",
"jasmine-spec-reporter": "7.0.0",
"jsdoc": "3.6.7",
"jsdoc-babel": "0.5.0",
"lint-staged": "10.2.3",
Expand Down
22 changes: 7 additions & 15 deletions spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,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 +729,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 +916,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 All @@ -949,7 +943,7 @@ describe('ParseLiveQuery', function () {
const response = (obj, prev) => {
expect(obj.get('sessionToken')).toBeUndefined();
expect(obj.sessionToken).toBeUndefined();
expect(prev?.sessionToken).toBeUndefined();
expect(prev && prev.sessionToken).toBeUndefined();
if (prev && prev.get) {
expect(prev.get('sessionToken')).toBeUndefined();
}
Expand All @@ -968,7 +962,7 @@ describe('ParseLiveQuery', function () {
user.set('yolo', 'bar');
await user.save();
await user.destroy();
await new Promise(resolve => process.nextTick(resolve));
await new Promise(resolve => setTimeout(resolve, 10));
for (const key of events) {
expect(calls[key]).toHaveBeenCalled();
}
Expand All @@ -978,8 +972,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);
});
});
9 changes: 6 additions & 3 deletions spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3948,7 +3948,7 @@ describe('Parse.User testing', () => {
const response = (obj, prev) => {
expect(obj.get('authData')).toBeUndefined();
expect(obj.authData).toBeUndefined();
expect(prev?.authData).toBeUndefined();
expect(prev && prev.authData).toBeUndefined();
if (prev && prev.get) {
expect(prev.get('authData')).toBeUndefined();
}
Expand All @@ -3960,18 +3960,21 @@ describe('Parse.User testing', () => {
subscription.on(key, calls[key]);
}
const user = await Parse.User._logInWith('facebook');

user.set('foo', 'bar');
await user.save();
user.unset('foo');
await user.save();
user.set('yolo', 'bar');
await user.save();
await user.destroy();
await new Promise(resolve => process.nextTick(resolve));
await new Promise(resolve => setTimeout(resolve, 10));
for (const key of events) {
expect(calls[key]).toHaveBeenCalled();
}
subscription.unsubscribe();
const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient();
client.close();
await new Promise(resolve => setTimeout(resolve, 10));
});

describe('issue #4897', () => {
Expand Down
5 changes: 5 additions & 0 deletions spec/helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';
const CurrentSpecReporter = require('./support/CurrentSpecReporter.js');
const { SpecReporter } = require('jasmine-spec-reporter');

// Sets up a Parse API server for testing.
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000;
jasmine.getEnv().addReporter(new CurrentSpecReporter());
jasmine.getEnv().addReporter(new SpecReporter());

global.on_db = (db, callback, elseCallback) => {
if (process.env.PARSE_SERVER_TEST_DB == db) {
Expand Down
15 changes: 15 additions & 0 deletions spec/support/CurrentSpecReporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Sets a global variable to the current test spec
// ex: global.currentSpec.description

global.currentSpec = null;

class CurrentSpecReporter {
specStarted(spec) {
global.currentSpec = spec;
}
specDone() {
global.currentSpec = null;
}
}

module.exports = CurrentSpecReporter;

0 comments on commit 974e903

Please sign in to comment.