Fixed Cloud functions/triggers async rejection crashing server.
This commit is contained in:
@@ -153,12 +153,26 @@ describe('miscellaneous', function() {
|
||||
});
|
||||
|
||||
it('basic beforeSave rejection', function(done) {
|
||||
var obj = new Parse.Object('BeforeSaveFailure');
|
||||
var obj = new Parse.Object('BeforeSaveFail');
|
||||
obj.set('foo', 'bar');
|
||||
obj.save().then(() => {
|
||||
fail('Should not have been able to save BeforeSaveFailure class.');
|
||||
done();
|
||||
}, () => {
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it('basic beforeSave rejection via promise', function(done) {
|
||||
var obj = new Parse.Object('BeforeSaveFailWithPromise');
|
||||
obj.set('foo', 'bar');
|
||||
obj.save().then(function() {
|
||||
fail('Should not have been able to save BeforeSaveFailure class.');
|
||||
done();
|
||||
}, function(error) {
|
||||
expect(error.code).toEqual(Parse.Error.SCRIPT_FAILED);
|
||||
expect(error.message).toEqual('Nope');
|
||||
|
||||
done();
|
||||
})
|
||||
});
|
||||
@@ -250,6 +264,20 @@ describe('miscellaneous', function() {
|
||||
// We should have been able to fetch the object again
|
||||
fail(error);
|
||||
});
|
||||
})
|
||||
|
||||
it('basic beforeDelete rejection via promise', function(done) {
|
||||
var obj = new Parse.Object('BeforeDeleteFailWithPromise');
|
||||
obj.set('foo', 'bar');
|
||||
obj.save().then(function() {
|
||||
fail('Should not have been able to save BeforeSaveFailure class.');
|
||||
done();
|
||||
}, function(error) {
|
||||
expect(error.code).toEqual(Parse.Error.SCRIPT_FAILED);
|
||||
expect(error.message).toEqual('Nope');
|
||||
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it('test beforeDelete success', function(done) {
|
||||
|
||||
Reference in New Issue
Block a user