parse-mockdb
parse-mockdb copied to clipboard
Cloud jobs
I didn't really find a way to call cloud jobs using this lib:
(node:9393) UnhandledPromiseRejectionWarning: TypeError: Parse.Cloud.job is not a function
This is my temporary solution by just adding this file mock.CloudJob.js somewhere:
module.exports = function(Parse){
Parse.Cloud = {
jobs:{},
define: function(){},
job: function(k,f){
Parse.Cloud.jobs[k] = f
},
startJob: function(k,v){
return Parse.Cloud.jobs[k](v)
}
}
}
Now in your code you can do require('mock.CloudJob')(Parse) and register & start Cloud-jobs as usual.
NOTE: I know this hack doesn't really follow the narrative of this lib, therefore I just figured to post this here (instead of doing a PR which doesn't really fit this lib). It might be useful to someone, or could start a brainstorm for Cloud-jobs in parse-mockdb.