Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
## 2.3.1
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.3.0...2.3.1)

- `_linkWith` and `_unlinkFrom` support MasterKey and SessionToken options ([#767](https://github.com/parse-community/Parse-SDK-JS/pull/767))
- Correct homepage in package.json ([#9e198b3](https://github.com/parse-community/Parse-SDK-JS/commit/9e198b368862925025737aa725e9a2e8b3d4205a))
- Add Issues template for opening GitHub Issue ([#760](https://github.com/parse-community/Parse-SDK-JS/pull/760))
- Add Public email address to satisfy an npmjs requirement ([#764](https://github.com/parse-community/Parse-SDK-JS/pull/764))
Expand Down
3 changes: 1 addition & 2 deletions greenkeeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"default": {
"packages": [
"integration/package.json",
"package.json",
"vendor/babel-plugin-dead-code-elimination/package.json"
"package.json"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cloud/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Parse.Cloud.job('CloudJob2', function() {
resolve({
status: 'cloud job completed'
})
}, 3000);
}, 1000);
});
});

Expand Down
18 changes: 11 additions & 7 deletions integration/test/ParseCloudTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const assert = require('assert');
const clear = require('./clear');
const Parse = require('../../node');
const sleep = require('./sleep');

describe('Parse Cloud', () => {
beforeAll((done) => {
Expand Down Expand Up @@ -88,13 +89,16 @@ describe('Parse Cloud', () => {
});
});

it('run long job', (done) => {
Parse.Cloud.startJob('CloudJob2').then((jobStatusId) => {
return Parse.Cloud.getJobStatus(jobStatusId);
}).then((jobStatus) => {
assert.equal(jobStatus.get('status'), 'running');
done();
});
it('run long job', async () => {
const jobStatusId = await Parse.Cloud.startJob('CloudJob2');

let jobStatus = await Parse.Cloud.getJobStatus(jobStatusId);
assert.equal(jobStatus.get('status'), 'running');

await sleep(2000);

jobStatus = await Parse.Cloud.getJobStatus(jobStatusId);
assert.equal(jobStatus.get('status'), 'succeeded');
});

it('run bad job', (done) => {
Expand Down
40 changes: 15 additions & 25 deletions integration/test/ParseLiveQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const assert = require('assert');
const clear = require('./clear');
const Parse = require('../../node');
const sleep = require('./sleep');

const TestObject = Parse.Object.extend('TestObject');
const DiffObject = Parse.Object.extend('DiffObject');
Expand All @@ -15,7 +16,7 @@ describe('Parse LiveQuery', () => {
clear().then(done).catch(done.fail);
});

it('can subscribe to query', async () => {
it('can subscribe to query', async (done) => {
const object = new TestObject();
await object.save();

Expand All @@ -25,12 +26,13 @@ describe('Parse LiveQuery', () => {

subscription.on('update', object => {
assert.equal(object.get('foo'), 'bar');
done();
})
object.set({ foo: 'bar' });
await object.save();
});

it('can subscribe to multiple queries', async (done) => {
it('can subscribe to multiple queries', async () => {
const objectA = new TestObject();
const objectB = new TestObject();
await Parse.Object.saveAll([objectA, objectB]);
Expand All @@ -52,14 +54,11 @@ describe('Parse LiveQuery', () => {
})
await objectA.save({ foo: 'bar' });
await objectB.save({ foo: 'baz' });

setTimeout(() => {
assert.equal(count, 2);
done();
}, 100);
await sleep(1000);
assert.equal(count, 2);
});

it('can subscribe to multiple queries different class', async (done) => {
it('can subscribe to multiple queries different class', async () => {
const objectA = new TestObject();
const objectB = new DiffObject();
await Parse.Object.saveAll([objectA, objectB]);
Expand All @@ -81,14 +80,11 @@ describe('Parse LiveQuery', () => {
})
await objectA.save({ foo: 'bar' });
await objectB.save({ foo: 'baz' });

setTimeout(() => {
expect(count).toBe(2);
done();
}, 1000);
await sleep(1000);
assert.equal(count, 2);
});

it('can unsubscribe to multiple queries different class', async (done) => {
it('can unsubscribe to multiple queries different class', async () => {
const objectA = new TestObject();
const objectB = new DiffObject();
await Parse.Object.saveAll([objectA, objectB]);
Expand All @@ -110,14 +106,11 @@ describe('Parse LiveQuery', () => {
subscriptionA.unsubscribe();
await objectA.save({ foo: 'bar' });
await objectB.save({ foo: 'baz' });

setTimeout(() => {
assert.equal(count, 1);
done();
}, 1000);
await sleep(1000);
assert.equal(count, 1);
});

it('can unsubscribe with await to multiple queries different class', async (done) => {
it('can unsubscribe with await to multiple queries different class', async () => {
const objectA = new TestObject();
const objectB = new DiffObject();
await Parse.Object.saveAll([objectA, objectB]);
Expand All @@ -139,10 +132,7 @@ describe('Parse LiveQuery', () => {
await subscriptionA.unsubscribe();
await objectA.save({ foo: 'bar' });
await objectB.save({ foo: 'baz' });

setTimeout(() => {
assert.equal(count, 1);
done();
}, 1000);
await sleep(1000);
assert.equal(count, 1);
});
});
5 changes: 5 additions & 0 deletions integration/test/sleep.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = function(ms) {
return new Promise(function(resolve) {
setTimeout(resolve, ms);
});
};
Loading