It looks like ParseMockDB.registerHook expects a promise, even though regular Cloud Code beforeX handlers are of type function(request,response). The contract should be identical to Cloud Code's for fidelity. callbacks are a pain!
EDIT: Okay, instead of function(request,response), how about we replace the response part with promise syntax, but leave the request as a parameter: i.e. function(request).
Check the Parse.Object docs. Most *Request types are the same as each other and the *Response types are the same as each other too:
Parse.Cloud.AfterDeleteRequest
Parse.Cloud.AfterSaveRequest
Parse.Cloud.BeforeDeleteRequest
Parse.Cloud.BeforeDeleteResponse
Parse.Cloud.BeforeSaveRequest
Parse.Cloud.BeforeSaveResponse
Note: some assumptions have to be made about the masterKey.
It looks like
ParseMockDB.registerHookexpects a promise, even though regular Cloud Code beforeX handlers are of typefunction(request,response).The contract should be identical to Cloud Code's for fidelity.callbacks are a pain!EDIT: Okay, instead of
function(request,response), how about we replace theresponsepart with promise syntax, but leave therequestas a parameter: i.e.function(request).Check the Parse.Object docs. Most
*Requesttypes are the same as each other and the *Responsetypes are the same as each other too:Parse.Cloud.AfterDeleteRequest
Parse.Cloud.AfterSaveRequest
Parse.Cloud.BeforeDeleteRequest
Parse.Cloud.BeforeDeleteResponse
Parse.Cloud.BeforeSaveRequest
Parse.Cloud.BeforeSaveResponse
Note: some assumptions have to be made about the
masterKey.