Update parse SDK to 2.0.0 (#4925)

* WIP: Integrate JS SDK v2

- Removes backbone style callbacks
- Use Promise instead of Parse.Promise

* Fixes ParseObject and ParseRelation

* Updates Parse.Query with promises

* Alls tests should pass

* Ensure a fresh user is used for each test

* Use REST implementation to avoid side effects for username/email duplicates

* Uses js sdk v2
This commit is contained in:
Florent Vilmart
2018-08-05 13:58:07 -04:00
committed by GitHub
parent a61ef7ee2f
commit ff25ae254d
30 changed files with 3217 additions and 4783 deletions

View File

@@ -287,7 +287,7 @@ describe('Hooks', () => {
promises.push(Parse.Hooks.createFunction("AFunction" + i, "http://url.com/function" + i));
}
Parse.Promise.when(promises).then(function(){
Promise.all(promises).then(function(){
for (let i = 0; i < 5; i++) {
// Delete everything from memory, as the server just started
triggers.removeTrigger("beforeSave", "MyClass" + i, Parse.applicationId);
@@ -441,7 +441,7 @@ describe('Hooks', () => {
}).then(function(res) {
expect(res.get("hello")).toEqual("world");
done();
}).fail((err) => {
}).catch((err) => {
jfail(err);
fail("Should not fail creating a function");
done();
@@ -462,7 +462,7 @@ describe('Hooks', () => {
}).then(function(res) {
expect(res.get("hello")).toEqual("world");
done();
}).fail((err) => {
}).catch((err) => {
fail(`Should not fail: ${JSON.stringify(err)}`);
done();
});
@@ -485,19 +485,18 @@ describe('Hooks', () => {
const obj = new Parse.Object("SomeRandomObject");
return obj.save();
}).then(function() {
const promise = new Parse.Promise();
// Wait a bit here as it's an after save
setTimeout(() => {
expect(triggerCount).toBe(1);
new Parse.Query("AnotherObject")
.get(newObjectId)
.then((r) => promise.resolve(r));
}, 500);
return promise;
return new Promise((resolve) => {
setTimeout(() => {
expect(triggerCount).toBe(1);
new Parse.Query("AnotherObject")
.get(newObjectId)
.then((r) => resolve(r));
}, 500);
});
}).then(function(res){
expect(res.get("foo")).toEqual("bar");
done();
}).fail((err) => {
}).catch((err) => {
jfail(err);
fail("Should not fail creating a function");
done();