Skip to content

modernize cloud code #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 16, 2018
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
30 changes: 16 additions & 14 deletions integration/cloud/main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
/* global Parse */
Parse.Cloud.define("bar", function(request, response) {
Parse.Cloud.define("bar", function(request) {
if (request.params.key2 === "value1") {
response.success('Foo');
return 'Foo';
} else {
response.error("bad stuff happened");
throw "bad stuff happened";
}
});

Parse.Cloud.job('CloudJob1', function(request, response) {
response.success({
Parse.Cloud.job('CloudJob1', function() {
return {
status: 'cloud job completed'
});
};
});

Parse.Cloud.job('CloudJob2', function(request, response) {
setTimeout(function() {
response.success({
status: 'cloud job completed'
})
}, 3000);
Parse.Cloud.job('CloudJob2', function() {
return new Promise((resolve) => {
setTimeout(function() {
resolve({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope it's gonna work :)

status: 'cloud job completed'
})
}, 3000);
});
});

Parse.Cloud.job('CloudJobFailing', function(request, response) {
response.error('cloud job failed');
Parse.Cloud.job('CloudJobFailing', function() {
throw 'cloud job failed';
});
4 changes: 2 additions & 2 deletions integration/test/ParseGeoPointTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Geo Point', () => {
});
});

it('can measure distance within km - mid peninsula', (done) => {
it('can measure distance within miles - mid peninsula', (done) => {
const sfo = new Parse.GeoPoint(37.6189722, -122.3748889);
const query = new Parse.Query(TestPoint);
query.withinMiles('location', sfo, 10.0);
Expand Down Expand Up @@ -406,7 +406,7 @@ describe('Geo Point', () => {
});
});

it('can measure distance within km unsorted - mid peninsula', (done) => {
it('can measure distance within miles unsorted - mid peninsula', (done) => {
const sfo = new Parse.GeoPoint(37.6189722, -122.3748889);
const query = new Parse.Query(TestPoint);
query.withinMiles('location', sfo, 10.0, false);
Expand Down
2 changes: 1 addition & 1 deletion integration/test/ParseQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Parse Query', () => {
return query.find();
}).then((results) => {
assert.equal(results.length, 1);
assert.equal(results[0].get('foo'), 'baz');
assert.equal(['baz', 'qux'].includes(results[0].get('foo')), true);
done();
}).catch(done.fail);
});
Expand Down
143 changes: 119 additions & 24 deletions package-lock.json

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